1.

You have written an automation code with both implicit and explicit wait commands. However, the elementNotVisible exception is still thrown. How do you fix this issue, without extending the wait timings in implicit or explicit waits?

Answer»

In this case, we can use a command called fluent wait, which is an extension of the explicit wait command. With fluent wait, we can also set the frequency with which the condition is checked before throwing the elementNotVisible exception.

 Wait wait = new FluentWait<WebDriver>(driver)
.withTimeout(45, TimeUnit.SECONDS)
.pollingevery(5, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class);

While a timeout value is a time taken to wait for a condition, polling frequency is the frequency to check the success or failure of the condition.




Discussion

No Comment Found