Implicit Waits in Selenium | Selenium WebDriver Tutorial

Implicit Waits:

Implicit waits tell to the WebDriver to wait for certain amount of time before it throws an exception. Once we set the time, WebDriver will wait for the element based on the time we set before it throws an exception. The default setting is 0 (zero). We need to set some wait time to make WebDriver to wait for the required time.

Note: Implicit Wait is in place for the entire time the browser is open. Time taken to search all the elements are based on the time fixed for the implicit wait.

Must Read: WebDriverWait in Selenium

Syntax:

Implicit Wait time is applied to all the elements in the script.

Implicit wait will accept 2 parameters, the first parameter will accept the time as an integer value and the second parameter will accept the time measurement in terms of SECONDS, MINUTES, MILISECOND, MICROSECONDS, NANOSECONDS, DAYS, HOURS, etc.

Must Read: FluentWait in Selenium

Test script with an explanation – Implicit Waits in Selenium:

Find the sample script (using Java) mentioned below. Execute it to see the functionality of Implicit Wait in Selenium.

There are some instances when a particular element takes more time (eg. 1 min) to load. In such cases setting a huge time to Implicit wait makes the browser to wait for the same time for every element. To avoid this, we need to implement Explicit Waits.

If you are not regular reader of my blog then I highly recommend you to sign up for the free email newsletter using the below link.

Subscribe and get a free eBook and regular updates from SoftwareTestingMaterial.com

Rajkumar SM is a founder of SoftwareTestingMaterial. He is a certified Software Test Engineer by profession and blogger & youtuber by choice. He has an extensive experience in the field of Software Testing. He writes here about Software Testing which includes both Manual and Automation Testing. He loves to be with his wife and cute little kid 'Freedom'.

Leave a Comment

Share via
Copy link
Powered by Social Snap