Explicit wait

There are times when the app under test can be slow on certain specific elements, such as page submit, form submit, or somewhere it fetches data from an external system and takes a little more time to load. In that case, using implicit wait to handle the situation will be a flawed approach, given that it has to wait for each and every element for the same specified time.

To handle this situation, we can use explicit wait for such elements. In explicit wait, we tell the web driver instance to wait for a certain condition invoked through ExpectedConditions. So, this wait applies explicitly to the specified element. Explicit wait can be invoked using this code:

WebDriverWait wait = new WebDriverWait(appiumDriver, 10);wait.until( ...

Get Mobile Test Automation with Appium now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.