How to use Implicit wait in Selenium Webdriver

This guide will help you to understand implicit wait in Selenium Webdriver and implementation as well. If you have ever worked on any automation tool then you must be aware of Sync issues in the script.

It is one of biggest challenge to handle sync issue between elements.

Sometimes an application will not able to load elements due to below issues
  • Network issue
  • Application issues
  • Browser stopping JavaScript call et
By default, Selenium will not wait for an element once page load completes. It checks for an element on the page then it performs some operation based on your script but if the element is not present then it throws NoSuchElementException.
Selenium Default timeout is ZERO.
Our main intention to use Implicit wait in selenium is to instruct Webdriver that wait for a specific amount before throwing an exception.

I will highly recommend using implicit wait in your every selenium script.

Implicit wait in selenium webdriver will be applicable throughout your script and will works on all element in the script once your specified implicit wait.

Syntax of Implicit wait in selenium webdriver
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

Here in above example I have used TimeUnit as seconds but you have so many options to use

Seconds, Minutes, Days, Hours, Microsecond, Milliseconds and so on check below screenshot for more information.



Once you move forward, you will get to know some more Timeout in Selenium like

  • Page load timeout in Selenium
  • Script load timeout in Selenium
  • Implicit wait in selenium Webdriver

I will cover all timeout with separate exampl

Complete program with usage of implicit wait in selenium webdriver




Console- Above script will fail because no login id is present on the page but it will wait for max 30 second before throwing an exception.



This is the max time so if any element is coming before 30 seconds it will move to next element.