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

Implicit wait


Implicit wait is a way to tell the Appium driver to poll the DOM (Document Object Model) for a certain amount of time before throwing an exception to the effect that it can't find the element on the page. The default timeout value is set to 0 seconds. Once we set the implicit wait to a specified time, it persists for the life of the webdriver object instance. How to set an implicit wait is explained here:

appiumDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

So, what this implies is letting the driver instance wait for a maximum of 10 seconds before throwing the NoSuchElement exception. We need to be watchful about the implicit usage. The Appium boilerplate generally gives us the code with the implicit wait implementation, so note the preceding line in the HomePageWebSteps class file, as shown:

appiumDriver = new AppiumDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
appiumDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

Increasing the...

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 $15.99/month. Cancel anytime}