线程“main”java.lang.noclassdeffounderror中出现异常(java、appium、android studio)

uurv41yg  于 2021-08-20  发布在  Java
关注(0)|答案(1)|浏览(343)

当我从EclipseIDE执行时,我在运行时不断遇到错误。我为commons-lang3、java客户端和selenium webdriver for java jar包添加了类路径。我错过了什么?
我的代码:

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;

public class InstallAppAndroidEmulator {

    public static void main(String[] args) {

        DesiredCapabilities dc = new DesiredCapabilities();

        dc.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");
        dc.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
        dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, 9.0);
        dc.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
        dc.setCapability(MobileCapabilityType.APP, "C:\\Users\\Some_Name\\Desktop\\apk files\\app-test.apk");

        URL url = null;
        try {
            url = new URL("http://localhost:4723/wd/hub");
            AndroidDriver<WebElement> driver = new AndroidDriver<WebElement>(url, dc);
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

}

文件夹:

错误消息:

通过从lib文件夹添加缺少的selenium JAR(除非使用独立库)来解决此问题

ui7jx7zq

ui7jx7zq1#

通过从lib文件夹中添加丢失的selenium jar(如果使用独立库,则不需要)

相关问题