June 2018
Beginner to intermediate
376 pages
8h 58m
English
At the core of explicit waits is the incredibly powerful fluent wait API. All WebDriverWait objects extend FluentWait. So, why would we want to use FluentWait?
Well, we get more granular control of the wait object, and we can easily specify exceptions to ignore. Let's have a look at an example:
Wait<WebDriver> wait = new FluentWait<>(driver) .withTimeout(Duration.ofSeconds(15)) .pollingEvery(Duration.ofMillis(500)) .ignoring(NoSuchElementException.class) .withMessage("The message you will see in if a TimeoutException is thrown");
As you can see, in the preceding code snippet, we have created a wait object with a 15-second timeout that polls every 500 milliseconds to see whether a condition is met. ...
Read now
Unlock full access