Synchronizing a test with FluentWait
The FluentWait
class is an implementation of Selenium WebDriver's Wait
interface. Using the FluentWait
class, we can define the maximum amount of time to wait for an element or condition as well as the frequency with which to check for the condition. We can also configure it to ignore specific types of exceptions such as the NoSuchElement
exception while searching for an element.
Unlike implicit and explicit wait, FluentWait
uses a maximum timeout value and polling frequency. For example, if we set the maximum timeout value as 20 seconds and polling frequency as 2 seconds, WebDriver will check for an element every 2 seconds until the maximum value. In addition to this, we can configure FluentWait
to ignore specific types of exceptions while waiting for the condition.
The FluentWait
class is helpful in automating AJAX applications or scenarios where element load time varies often.
In this recipe, we will explore some of these conditions with the FluentWait...