I'm starting an already installed app using appium.
After my driver is initialized. How do I make it poll-wait till certain activity is displayed?
I saw only this way to wait for activity when starting up
cap.setCapability("app-wait-activity", "activity-to-wait-for");
Is there any other way? How do I wait to another specific activity when not initializing. Say after a button click?
just sleep x seconds
?
Specific activity means some specific element is being displayed. I use the following code to wait until some certain element on the screen:
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.elementToBeClickable(By
.xpath("//android.widget.Button[contains(@text, 'Log In')]")));
or:
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.presenceOfElementLocated(By
.xpath("//android.widget.TextView[contains(@resource-id, 'action_bar_title')]")));