尝试运行appium脚本时出现错误

时间:2018-12-25 23:24:03

标签: java selenium intellij-idea appium

我正在尝试运行使用远程appium服务器的程序,而只是打开“ google play store”应用,我正在使用以下代码:

public class AppiumTest {

  public static void main(String[] args) {

    //Set the Desired Capabilities
    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setCapability("deviceName", "Galaxy S8+");
    caps.setCapability("udid", "<UDID>"); //Give Device ID of your mobile phone
    caps.setCapability("platformName", "Android");
    caps.setCapability("platformVersion", "8.0.0");
    caps.setCapability("browserName", "Chrome");
    caps.setCapability("noReset", true);

    //Set ChromeDriver location
    System.setProperty("webdriver.chrome.driver","C:\\Users\\Lenovo\\IdeaProjects\\assignment\\src\\main\\java\\resources\\chromedriver.exe");

    //Instantiate Appium Driver
    AppiumDriver<MobileElement> driver = null;
    try {
        driver = new AndroidDriver<MobileElement>(new URL("http://0.0.0.0:4723/wd/hub"), caps);

    } catch (MalformedURLException e) {
        System.out.println(e.getMessage());
    }

    //Open URL in Chrome Browser
    driver.get("http://www.google.com");
  }
}

当我在intellij中运行(intellij)此代码时,出现以下错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/internal/ApacheHttpClient$Factory

我尝试在Google中找到针对此错误的解决方案,但未成功。 我该如何解决这个烦人的问题?

0 个答案:

没有答案