Selenium 4 uses the W3C WebDriver standard protocol for browser automation. As browser vendors will only support W3C WebDriver in the future, using Selenium 4 ensures the widest possible range of support across all browsers, making your automation scripts future proof.
Selenium 4 relative locators are a way of locating elements by using more natural language friendly terms, such as “above”, “below”, “left of”, “right of”, and “near”. In general, you could think about them as a way to locate elements based on the visual placement on the page.
Selenium 4 includes a new command to help users create a new tab or a new window. Check some code examples that show how to use it.
Selenium 4 will allow users to print a page as a PDF through Chrome and Firefox.
The upcoming version of Selenium exposes a few new features with Firefox, such as a full page screenshot, a simplified way to install add-ons, and updating Firefox preferences in the middle of the session.
Selenium 4 exposes a set of utilities to modify the network conditions in Chromium based browsers, useful to test web applications under different network conditions.
Two new methods have been added to more precisely get a given element attribute or a property. It is recommended to use one of the new methods for performance and preciseness, specially if you are using Sauce Labs.
Selenium Grid 4 has been rewritten from scratch, with all the learnings from the past. It takes advantage of modern infrastructure (such as Docker and distributed tracing).
If you've already updated your Selenium 3 capabilities to be W3C compliant, your code should continue to work. Some of the language bindings have updated the recommended code for 4.0, however, so some minor changes might be desired. More details can be found in our Selenium 4 upgrade guide.
Tests will continue to run on our platform. However, if you are not doing it yet, Sauce Labs specific capabilities need to be placed inside the
sauce:options block. With that, Sauce specific features for your tests (specifying browser versions, initiating secure tunnels, Extended Debugging, etc.), will continue to work well.
Examples showing how to create a
sauce:options block can be seen in our Selenium 4 upgrade guide and in the Selenium section inside the Sauce Labs docs.