当我从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(除非使用独立库)来解决此问题
1条答案
按热度按时间ui7jx7zq1#
通过从lib文件夹中添加丢失的selenium jar(如果使用独立库,则不需要)