Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mobile Test Automation with Appium

You're reading from  Mobile Test Automation with Appium

Product type Book
Published in Jun 2017
Publisher Packt
ISBN-13 9781787280168
Pages 256 pages
Edition 1st Edition
Languages
Author (1):
Nishant Verma Nishant Verma
Profile icon Nishant Verma

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(ExpectedConditions.visibilityOfElementLocated(By.id("text1")));

In the preceding code, we are creating an instance of WebDriverWait with a maximum waiting time of 10 seconds and then using an ExpectedConditions, which tells the driver to wait till the visibility...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}