有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java无法在appium中出现弹出窗口后单击按钮

我使用过appium 1.6.4,安卓版本是5.1、6.1和7.0

enter image description here

下面是我的代码

公共布尔值navigateToLoginPage(){

    String strng = null;
    newObj = new LogInPage();
    wait = new WebDriverWait(driver,20);
    wait.until(ExpectedConditions.visibilityOf(GetStarted));
    GetStarted.click();
    driver.manage().timeouts().implicitlyWait(5000, TimeUnit.MILLISECONDS);

    if(Country.isDisplayed()){
        Country.click();
        wait.until(ExpectedConditions.visibilityOf(Cancel));
        Cancel.click();
    } 
    driver.manage().timeouts().implicitlyWait(4000, TimeUnit.MILLISECONDS); 
    MobileNumber.sendKeys("91**********");

    Next.click();
    driver.manage().timeouts().implicitlyWait(3000, TimeUnit.MILLISECONDS);
    OK.click();// this is the problem , this sometimes works sometimes not 

//我使用了警报界面,但没有使用

//如果(OK.isEnabled()){OK.click();}它返回true,我也使用了。显示了,但没有用

//未单击“确定”按钮但执行try块中的代码时 //我也使用了点击功能,但没有效果

        try {
            strng =newObj.try1();
        } catch (SQLException e) {
            e.printStackTrace();
        }

    wait.until(ExpectedConditions.visibilityOf(EnterOTP));
    EnterOTP.sendKeys(strng);
    Next.click();
    return true;    
}

共 (0) 个答案