Selenium WebDriver Waits: Implicit, Explicit and Fluent Wait

In this post, you will learn about different waits in Selenium. Waits are required to tell Selenium to wait for a specific amount for elements on the web page before throwing "No Such Element Exception". There are three types waits in Selenium Webdriver, out of which first two are the most popular.
  1. Implicit Wait
  2. Explicit Wait
  3. Fluent Wait

Implicit Wait

Implicit wait is used to set a default wait time (say 30 secs) in your automation script to wait for an  element on the page.

Key Points

  • Implicit wait should be declared in your setup method (at beginning lines of your code).
  • Default wait time for Implicit wait is 0 secs.
  • Once implicit wait is set, it is applicable for the whole automation script.
  • In simple words, you can also say that implicit wait is the maximum time set between two steps/commands of the automation script.
  • Webdriver throws "No Such Element Exception" if element is not found in specified time.


// Implicit wait - Set wait of 10 seconds
 driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

Explicit Wait

Explicit wait can be called as conditional wait. It tells the WebDriver to wait for certain conditions before maximum time exceeded.

Key Points

  • Explicit wait is intelligent wait, as it waits certain conditions.
  • It applies to only single element and not to whole script.
  • It provides a better approach to handle dynamic ajax elements.
  • Explicit wait is the best way to replace Thread.sleep() (as static waits are not recommended in automation).
  • WebDriver throws "ElementNotVisibleException" if explicit wait fails.


// Explicit Wait
 WebDriverWait wait = new WebDriverWait(driver, 10); 

All Expected Conditions that can be used in Explicit Wait:

    1. alertIsPresent()
    2. elementSelectionStateToBe()
    3. elementToBeClickable()
    4. elementToBeSelected()
    5. frameToBeAvaliableAndSwitchToIt()
    6. invisibilityOfTheElementLocated()
    7. invisibilityOfElementWithText()
    8. presenceOfAllElementsLocatedBy()
    9. presenceOfElementLocated()
    10. textToBePresentInElement()
    11. textToBePresentInElementLocated()
    12. textToBePresentInElementValue()
    13. titleIs()
    14. titleContains()
    15. visibilityOf()
    16. visibilityOfAllElements()
    17. visibilityOfAllElementsLocatedBy()
    18. visibilityOfElementLocated()

    Fluent Wait

    Fluent wait is kind of conditional wait but with frequency. It means fluent wait is used to wait for a condition with a regular frequency/time interval to be checked before throwing "ElementNotVisibleException".


    There might be a scenario where an element X might load with in 30 secs. In this case we can set 5 secs of frequency, so it will check after every 5 secs for the element X. So, ideally it will check for 6 times before throwing "ElementNotVisibleException". If element X loads within 30 secs, program flow would move to the next step of automation script.


    // Fluent Wait
     Wait wait = new FluentWait(WebDriver reference)
       .withTimeout(timeout, SECONDS)
       .pollingEvery(timeout, SECONDS)
     WebElement foo = wait.until(new Function() {
      public WebElement applyy(WebDriver driver) {
       return driver.findElement("foo"));

    Find Element & Locators  << Previous     ||     Next >>  Form Commands (Click, enter text etc)

    Follow Us

    Quora Space | Facebook Page | Telegram Channel
    Feel free to ask queries or share your thoughts in comments or email us.


    Popular posts from this blog

    10 Best Demo Websites for Automation Testing Practice

    Automate 'User Registration' of E-commerce Website using Selenium

    Selenium WebDriver Browser and Navigation Commands

    Automate 'Buy Product' from E-commerce Website using Selenium