Book Image

Learning Selenium Testing Tools with Python

By : UNMESH GUNDECHA
Book Image

Learning Selenium Testing Tools with Python

By: UNMESH GUNDECHA

Overview of this book

Table of Contents (17 chapters)
Learning Selenium Testing Tools with Python
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using implicit wait


The implicit wait offers a generic way to synchronize the entire test or group of steps in WebDriver. Implicit wait is useful in dealing with situations where the application's response time is inconsistent due to network speed or applications that use dynamically rendered elements with Ajax calls.

When we set an implicit wait on WebDriver, it polls or searches the DOM for a certain amount of time to find an element or elements if they are not immediately available. By default, the implicit wait timeout is set to 0.

Once set, the implicit wait is set for the life of the WebDriver instance or for the entire duration of the test, and the WebDriver applies this implicit wait for all the steps that find the elements on the page unless we set it back to 0.

The webdriver class provides the implicitly_wait() method to configure timeout. We created a SearchProductTest test in Chapter 2, Writing Tests Using unittest. We will modify this test and add an implicit wait with timeout...