Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mobile Test Automation with Appium

You're reading from   Mobile Test Automation with Appium Mobile application testing made easy

Arrow left icon
Product type Paperback
Published in Jun 2017
Publisher Packt
ISBN-13 9781787280168
Length 256 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Nishant Verma Nishant Verma
Author Profile Icon Nishant Verma
Nishant Verma
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

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