我无法初始化 appium 驱动程序。请帮忙。
我在初始化时收到以下错误消息:
Exception in thread "main" java.lang.NoSuchMethodError: org.openqa.selenium.remote.http.HttpClient$Factory.createDefault()Lorg/openqa/selenium/remote/http/HttpClient$Factory;
at io.appium.java_client.remote.AppiumCommandExecutor.<init>(AppiumCommandExecutor.java:93)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:93)
at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:95)
at com.xceedance.framework.Hybrid.AppiumWebsite.main(AppiumWebsite.java:53)
我使用了以下代码-
AppiumDriver driver;
DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability("deviceName","emulator-5554");
capability.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2");
capability.setCapability("browserName","Chrome");
capability.setCapability("platformName","Android");
capability.setCapability(MobileCapabilityType.PLATFORM_VERSION, "7.1.1");
capability.setCapability("appPackage","com.android.chrome");
capability.setCapability("appActivity", "com.google.android.apps.chrome.Main");
driver=new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),capability);