Implicit Wait in Selenium

Implicit wait in Selenium 3.0

Implicit Wait in Selenium

Implicit wait in Selenium 3.0

All the elements on a web page may not get loaded at the same time when the page loads. We can’t access these elements unless they are visible (loaded), so we use wait to allow the elements to load. This is achieved through implicit and explicit wait in Selenium. In this tutorial, we are going to discuss implicit wait.

We have posted an article on Explicit wait earlier.


We will discuss Fluent wait in the last post of this series.

This tutorial is part of Free Selenium 3.0 Tutorials by Techcanvass. These tutorials are categorized into Java, Selenium, TestNG, Automation Framework and Grid.

What is implicit wait?

Implicit wait is a type of wait, which puts a wait time between the execution of two steps. The default wait time between two steps is zero.

Implicit wait allows the web driver to wait for the completion of a step or loading of an an element.

driver.manage().timeouts().implicitlyWait(Time period, TimeUnit.SECONDS);

Time period: The first argument is the number of seconds or minutes depending on the units used as the second argument.
TimeUnit.SECONDS: The second argument specifies the unit of time. In the above example, the unit used is Seconds. It can also be Minutes, Hours, microseconds, nanoseconds etc.

To specify a wait time of 10 seconds, we can write the following piece of code:

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

Difference between Implicit and Explicit Wait

Implicit waits, once specified, are in force till the browser is open (Web driver instance). Explicit waits are applicable for specified conditions only and will not be applicable, after the wait condition is TRUE or FALSE.

This means that you have a better control in case of Explicit wait. Two important cautions:

  • Don’t mix implicit and explicit wait as it might lead to unexpected lead time
  • Thread.sleep() is always an option but Selenium team advises against its usage

Implicit Wait Example

We will take up the same example used in the Explicit wait in Selenium 3.0 post. The example code is as given below:

package basicSeleniumScripts;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

public class ImplicitWaitEx {

    public static void main(String[] args) {
        System.setProperty(“”, “E:\\Selenium 3\\lib\\chromedriver.exe”);
        WebDriver driver;
        driver = new ChromeDriver();
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        System.out.println(“Email Text box is editable”);
    catch (Exception e)
        System.out.println(“The email text box is not yet visible”);
        //Quitting the web driver

As you can see above, we need just a single line of code to implement implicit wait.

About Techcanvass

Techcanvass offers IT certification courses for professionals. We are an IIBA endorsed education provider (EEP), iSQI ATP (for Certified Agile Business Analyst Training) as well as Agile Testing alliance partner for CP-SAT certification training in Selenium.

Our Selenium 3.0 Training programs along with DevOps courses are designed for Manual testing professionals with basics of Java and Python covered.

CP-SAT Certification Offer