Selenium WebDriver Extensions

Selenium WebDriver Extensions (SWE) is the library providing additional functionalities to the Selenium WebDriver.

New selectors

The main part of the functionality that the library adds is the support for jQuery and Sizzle selectors. While selectors provided by Selenium WebDriver are very powerful and can be used to locate virtually every element of the DOM being tested, it is sometimes easier and more convenient to use other types of selectors. Also, since most web developers are already familiar with jQuery syntax it may be more efficient for them to use what they already know instead of learning XPath to find something more complicated in the DOM tree than element by class name or identifier.

DOM elements and their visibility

Another potential application for new types of selectors is if you need to access elements that are currently not visible. Some of the selectors in Selenium WebDriver only return the elements that are visible in the browser at the time the lookup was performed. With jQuery and Sizzle selectors always all of the elements that are matching selector criteria will be returned. However, if the desired behavior is to find only the visible matches, this can be easily done by appending :visible filter to the selector query.

Easier JavaScript execution

Apart from the new selector capabilities the library contains methods for easier execution of arbitrary JavaScript code which can be used for setting the state of the application during state or to provide support for other types of JavaScript selector libraries.

Automatic external library loading

Before selector that uses external library is executed, the library will detect if the tested page has already this library loaded. If the library is not present than it will be loaded from a CDN. The URL which will be used to load the library can be found in WebDriverExtensions section. Using methods from WebDriverExtensions class the developer can change the external library URL and change the library load timeout, which defaults to 10 seconds.

Last updated

Was this helpful?