WebDriverWait Extensions

The WebDriverWait Extensions project provides several extension methods for the WebDriverWait object. It builds on the idea behind the ExpectedConditions class which was previously included with Selenium. There are now many more conditions that you can choose from and the conditions have been split into different areas: Element, Frame, Text, Title and URL.

When using the WebDriverWait object you might encounter the rather unhelpful exception:

Message: OpenQA.Selenium.WebDriverTimeoutException : Timed out after 10 seconds

Now each method will provide a meaningful exception, which should give you an indication of what has actually gone wrong.
For example:

Message: WebDriverWaitExtensions.NotExpectedException : The URL doesn't match 'www.different.com'.
 
Current URL: www.example.co.uk
Expected URL: www.different.com

This exception shows the error message which tells you exactly why the condition has failed. It also provides you with the expected outcome and what was actually found.

We’ve found this package to be very helpful with our automation scripts. The method itself is descriptive – so, within the code, you can see what the intention is. As an example, to wait until an element is visible, we could use the following method:

wait.UntilElement().IsVisible()

You can download the WebDriverWaitExtensions package via the NuGet package manager or install it using the cmd line.

PM> Install-Package WebDriverWaitExtensions -Version 2.0.0

To download the package directly go to NuGet.

This project is actively maintained, and we’re adding helpful conditions to the package as and when we come across them. For more information on what methods are provided and how to use the package, visit the project wiki.

If you have any issues, feedback or suggestions, then head over to the project at Github:
 WebDriverWait Extensions

Scroll to top