Appium. Mobile App Automation. Wait until

霸气de小男生 提交于 2021-01-28 02:16:26

问题


Friends, please help!

I don't know how to do "wait.until".

I'm using Appium with UIAutomator.

My test would wait until new app's page will loaded and 'Text 1' in text field will be checked.

I have such parameters in UIAutomator:

text : Text 1;

recource-id: payment_content_title;

class: android.widget.TextView;

package: ru.mts.stm.mobilemts;

IntelliJ says that my code is incorrect:

WebDriverWait wait;
    wait = new WebDriverWait(driver, 60);
    wait.until(ExpectedConditions.textToBe(new MobileBy.ByAndroidUIAutomator(text),"Text 1"));

Thanks


回答1:


Use the following code for wait.

 WebDriverWait wait;
    wait.until(ExpectedConditions.presenceOfElementLocated(By.id("put id here")));



回答2:


Hi you can use following method for the same :

 public MobileElement waitForElement(AppiumDriver<?> appiumDriver, MobileElement element) {
    webDriverWait = new WebDriverWait(appiumDriver, 15);
    webDriverWait.until(ExpectedConditions.elementToBeClickable(element));
    return element;
}


来源:https://stackoverflow.com/questions/45237474/appium-mobile-app-automation-wait-until

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!