Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Appium+;Selenium:配置失败:@BeforeTest setUp java.lang.NoClassDefFoundError:org/openqa/Selenium/remote/codec/w3c/W3CHttpCommandCodec_Java_Selenium_Appium - Fatal编程技术网

Appium+;Selenium:配置失败:@BeforeTest setUp java.lang.NoClassDefFoundError:org/openqa/Selenium/remote/codec/w3c/W3CHttpCommandCodec

Appium+;Selenium:配置失败:@BeforeTest setUp java.lang.NoClassDefFoundError:org/openqa/Selenium/remote/codec/w3c/W3CHttpCommandCodec,java,selenium,appium,Java,Selenium,Appium,我使用的是appium studio,我从中获得了代码,并在Eclipse中复制了它。我添加了所有maven依赖项,即使它抛出了配置失败的错误。有人帮我吗? 注意:我在这里使用的是真正的ios设备,我的平台是mac。java版本“11.0.2” 包iostestdemo; 导入io.appium.java_client.remote.IOSMobileCapabilityType; 导入io.appium.java_client.ios.IOSDriver; 导入io.appium.java_c

我使用的是appium studio,我从中获得了代码,并在Eclipse中复制了它。我添加了所有maven依赖项,即使它抛出了配置失败的错误。有人帮我吗? 注意:我在这里使用的是真正的ios设备,我的平台是mac。java版本“11.0.2”

包iostestdemo;
导入io.appium.java_client.remote.IOSMobileCapabilityType;
导入io.appium.java_client.ios.IOSDriver;
导入io.appium.java_client.ios.ios元素;
导入io.appium.java_client.remote.MobileCapabilityType;
导入org.openqa.selenium.remote.DesiredCapabilities;
导入org.openqa.selenium.By;
导入org.testng.annotations.*;
导入java.net.URL;
导入java.net.MalformedURLException;
导入java.util.logging.Level;
公开课二级考试{
私有字符串reportDirectory=“reports”;
私有字符串reportFormat=“xml”;
私有字符串testName=“Untitled”;
受保护的IOSDriver驱动程序=null;
DesiredCapabilities dc=新的DesiredCapabilities();
@预处理法
public void setUp()引发畸形的DurException{
dc.setCapability(“reportDirectory”,reportDirectory);
dc.setCapability(“报告格式”,报告格式);
dc.setCapability(“testName”,testName);
dc.设置能力(MobileCapabilityType.UDID,“AFB65172E9B47B01482D912DED58515819748A3”);
setCapability(iosmobilecapabilitype.BUNDLE_ID,“com.novo.ios.dev”);
驱动程序=新的IOSDriver(新的URL(“http://localhost:4723/wd/hub(香港特区),;
driver.setLogLevel(Level.INFO);
}
@试验
public void testUntitled(){
driver.findElement(By.xpath(“/*[@placeholder='Email']”)。单击();
driver.findElement(By.xpath(
“(/*[@text='Novo-Dev']/*/*[@class='UIAView'和./*[@class='UIAView'和./*[@class='UIAView']]和./*[@class='UIAView']]和./parent::*[@class='UIAWindow']])[2]”)
。单击();
driver.findElement(By.xpath(“/*[@placeholder='Email']”)。单击();
driver.findElement(By.xpath(“/*[@placeholder='Email'])).sendKeys(“abaddvdvd”);
findElement(By.xpath(“//*[@placeholder='Password'])).sendKeys(“vvv”);
driver.findelelement(By.xpath(“/*[@text='LOG-IN']”)。单击();
driver.findelelement(By.xpath(“/*[@text='OK']”)。单击();
}
}
我面临的错误:

FAILED CONFIGURATION: @BeforeMethod setUp
java.lang.NoClassDefFoundError: org/openqa/selenium/remote/codec/w3c/W3CHttpCommandCodec
    at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:262)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
    at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
    at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:323)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
    at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:37)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:86)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:96)
    at io.appium.java_client.ios.IOSDriver.<init>(IOSDriver.java:92)
    at iostestdemo.secondTest.setUp(secondTest.java:29)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
    at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:458)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:523)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
    at org.testng.TestRunner.privateRun(TestRunner.java:648)
    at org.testng.TestRunner.run(TestRunner.java:505)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
    at org.testng.SuiteRunner.run(SuiteRunner.java:364)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
    at org.testng.TestNG.runSuites(TestNG.java:1049)
    at org.testng.TestNG.run(TestNG.java:1017)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.codec.w3c.W3CHttpCommandCodec
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 41 more

SKIPPED: testUntitled
java.lang.NoClassDefFoundError: org/openqa/selenium/remote/codec/w3c/W3CHttpCommandCodec
    at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:262)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
    at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
    at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:323)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
    at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:37)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:86)
    at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:96)
    at io.appium.java_client.ios.IOSDriver.<init>(IOSDriver.java:92)
    at iostestdemo.secondTest.setUp(secondTest.java:29)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
    at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:458)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:523)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
    at org.testng.TestRunner.privateRun(TestRunner.java:648)
    at org.testng.TestRunner.run(TestRunner.java:505)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
    at org.testng.SuiteRunner.run(SuiteRunner.java:364)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
    at org.testng.TestNG.runSuites(TestNG.java:1049)
    at org.testng.TestNG.run(TestNG.java:1017)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.codec.w3c.W3CHttpCommandCodec
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 41 more


===============================================
    Default test
    Tests run: 1, Failures: 0, Skips: 1
    Configuration Failures: 1, Skips: 0
===============================================


===============================================
Default suite
Total tests run: 1, Failures: 0, Skips: 1
Configuration Failures: 1, Skips: 0
===============================================
配置失败:@beforethod安装程序
java.lang.NoClassDefFoundError:org/openqa/selenium/remote/codec/w3c/W3CHttpCommandCodec
在io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:262)
位于org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
在io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
在io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
位于io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
位于org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
位于io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:323)
位于org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:130)
位于io.appium.java_client.DefaultGenericMobileDriver。(DefaultGenericMobileDriver.java:37)
位于io.appium.java_client.AppiumDriver。(AppiumDriver.java:86)
位于io.appium.java_client.AppiumDriver。(AppiumDriver.java:96)
位于io.appium.java_client.ios.IOSDriver.(IOSDriver.java:92)
位于iostestdemo.secondTest.setUp(secondTest.java:29)
位于java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
位于java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
位于java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
位于java.base/java.lang.reflect.Method.invoke(Method.java:566)
位于org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
位于org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
位于org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:458)
位于org.testng.internal.Invoker.invokeConfigulations(Invoker.java:222)
位于org.testng.internal.Invoker.invokeMethod(Invoker.java:523)
位于org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
位于org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
位于org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
位于org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
位于org.testng.TestRunner.privateRun(TestRunner.java:648)
位于org.testng.TestRunner.run(TestRunner.java:505)
位于org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
在org.testng.SuiteRunner.runsequential上(SuiteRunner.java:450)
位于org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
运行(SuiteRunner.java:364)
位于org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
位于org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
在org.testng.testng.runSuitesSequentially上(testng.java:1208)
位于org.testng.testng.runSuitesLocally(testng.java:1137)
位于org.testng.testng.runSuites(testng.java:1049)
位于org.testng.testng.run(testng.java:1017)
位于org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
位于org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
位于org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
原因:java.lang.ClassNotFoundException:org.openqa.selenium.remote.codec.w3c.W3CHttpCommandCodec
位于java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
位于java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
位于java.base/java.lang。
<dependencies>
    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>7.1.0</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.14.3</version>
    </dependency>
</dependencies>
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>2.53.1</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>io.appium</groupId>
    <artifactId>java-client</artifactId>
    <version>4.1.2</version>
</dependency>