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 pain for an automation engineer to handle sync issue between elements.
Sometimes an application will not able to load elements due to below issues.
- Network issue
- Application issues
And so on.
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 NoSuchElement Exception.
This is one of the interview questions that what is the default timeout in Selenium is.
Answer- Default timeout is ZERO.
I have listed down some most frequent exception of Selenium. Hope it will help you.
If you are not sure how to handle exception then below post will help you.
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.
Note- 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.
Official documentation of implicit waits in selenium
Syntax of Implicit wait in selenium webdriver
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
Do not confuse with these exceptions because each of this having different usage.
I will cover all timeout with separate example
Complete program with usage of implicit wait in selenium webdriver
<span style="font-family: arial, helvetica, sans-serif;">
public class VerifyTitle
public void verifySeleniumTitle()
WebDriver driver=new FirefoxDriver();
// Specify implicit wait of 30 seconds
// No login id is present on Webpage so this will fail our script.
driver.findElement(By.id("login")).sendKeys(" 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.
Note- This is the max time so if any element is coming before 30 seconds it will move to next element.
Please comment below if any issues or any feedback 🙂