WebDriverWait In Selenium | Selenium WebDriver Tutorial

Selenium WebDriverWait is one of the Explicit waits.

Explicit waits are confined to a particular web element. Explicit Wait is code you define to wait for a certain condition to occur before proceeding further in the code.

Explicit wait is of two types:

  1. WebDriverWait
  2. FluentWait

Click on this link for FluentWait.

WebDriverWait In Selenium:

It is applied on certain element with defined expected condition and time. This wait is only applied to the specified element. This wait can also throw exception when element is not found.

We could avoid throwing exception in Selenium. Check this post.

The following are the 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()

Must Read: Waits in Selenium – Implicit, Explicit, FluentWait

Syntax:

Test script with an explanation:

Find the sample script (using Java) mentioned below. Execute it to see the functionality.

The default pooling period for implicit and explicit wait is 250 ms. Here in Fluent wait, we could change the default pooling period based on our requirement. Also we could ignore any exception while pooling element such as No Such Element exception.

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.

Sharing is caring.

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Like This Post?

We have a lot more where that came from?

We only send really good stuff occasionally, promise.

Rajkumar SM

Leave a Comment

Your email address will not be published. Required fields are marked *

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on whatsapp

Recent Posts:

Scroll to Top
API Testing eBook

DOWNLOAD FOR FREE