如何在Appium Java中解决java.lang.ClassNotFoundException?

时间:2019-06-18 06:32:19

标签: appium-android

我必须在appium中为Android应用程序执行登录活动。但是我的脚本中出现类未找到错误。我的应用程序已打开,但打开应用程序后未执行登录。

public class AppiumTest2 {
    AppiumDriver driver;

    public  void setup() throws Exception  {
        DesiredCapabilities Capabilities = new DesiredCapabilities();
        Capabilities.setCapability("deviceName", "codeblaze");
        Capabilities.setCapability("platforVersion", "7.0");
        Capabilities.setCapability("platformName", "Adnroid");
        Capabilities.setCapability("appPackage", "package name");
        Capabilities.setCapability("appActivity", "activity name");
        driver = new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"), Capabilities);


    }

    public void tearDown() throws Exception {
        driver.quit();
    }


    public void LogInWithInvalidEmail() {
        //WebElement emailLoginButton = driver.findElement(By.id("lllogin"));
        //emailLoginButton.click();

        WebElement emailTextField = (new WebDriverWait(driver,60)).until(ExpectedConditions.presenceOfElementLocated(By.id("etusername")));
        emailTextField.sendKeys("Invalid Email");

        WebElement passwordTextField = driver.findElement(By.id("etpassword"));
        passwordTextField.sendKeys("Random Password");

        WebElement loginButton = driver.findElement(By.id("lllogin"));
        loginButton.click();

    }

}

实际结果:我遇到以下错误:

  

java.lang.ClassNotFoundException:org.apache.commons.lang3.StringUtils

预期结果:不会出现上述错误,并且应在应用程序中执行登录活动。

0 个答案:

没有答案