线程“主”java.lang.NoClassDefFoundError 中的异常:org/openqa/selenium/remote/codec/w3c/W3CHttpCommandCodec
发布时间:2022-09-06 14:52:33 432
相关标签: # java# java# android
“线程中的异常”;“主要”;JAVAlang.NoClassDefFoundError:org/openqa/selenium/remote/codec/w3c/W3CHttpCommandCodec
这个错误是因为依赖关系吗?我在Stack Overflow检查了类似的问题,但没有想到如何解决它。
这是我的代码:
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.remote.MobileCapabilityType;
public class base {
public static AndroidDriver Capabilities() throws MalformedURLException {
File appdir=new File("src");
File app=new File(appdir,"ApiDemos-debug.apk");
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME,"Emulator1");
cap.setCapability(MobileCapabilityType.AUTOMATION_NAME,"uiautomator2");
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
AndroidDriver driver=new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"),cap);
return driver;
}
这是我在运行测试后看到的:
авг 13, 2019 11:26:55 PM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0
INFO: Detected dialect: W3C
Exception in thread "main" 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:552)
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.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:323)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:37)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:86)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:96)
at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:94)
at base.Capabilities(base.java:22)
at basics.main(basics.java:12)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.codec.w3c.W3CHttpCommandCodec
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 14 more
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报