How to “wait to activity” using Appium, on begin and during test itself?

前端 未结 7 1578
挽巷
挽巷 2020-12-31 04:06

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 onl

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-31 04:45

    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')]")));
    

提交回复
热议问题