Home > Selenium > Different types of waits in selenium

Different types of waits in selenium

This post was most recently updated on June 14th, 2019

There are three types of waits in selenium. Implicit wait, explicit wait and fluent wait.

Implicit wait:

Once you define implicit wait then it will wait for all findElement() and findElements(). Webdriver tries to find element in DOM after every polling time, if element is not found then it wait for polling time(0.5 Seconds) and again try to find the element until maximum time defined is over. If element is not found then it will throw NoSuchElementException.

Polling time can be changed using

Usage:

In above code it will wait for maximum 10 seconds if element is not found within 10 seconds then it will throw exception.

Explicit wait:

Explicit wait would be defined to particular web element. It will wait for single web element. For example if one of the web element takes more time than implicit wait then instead of changing implicit wait time it is better to define explicit wait.

Usage:

Fluent wait:

Fluent wait is similar to explicit wait the difference is in fluent wait we can define polling time. And we can ignore the exception.

Usage:

Selenium Tutorial >>

This Article is TAGGED in , , , . BOOKMARK THE permalink.

Avatar photo
Amit Bharamasali
Automation Software Test Engineer. Skills: Manual Testing, Selenium, Java, Protractor, JavaScript, Katalon Studio, Groovy, Appium, Sahi, Sahi Script and UI/UX testing.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">