Why should you upgrade to Selenium 4.0 ?
Enhanced Selenium Grid
The new Selenium Grid comes with Docker support. This will enable developers or testers to spin up the containers rather than setting up heavy virtual machines. Moreover, it is redesigned in a way that will allow QAs to deploy the grid on Kubernetes for better scaling. Managing Selenium Grid is now smooth and easy as there will no longer be any need to set up and start hubs and nodes separately.
Upgraded Selenium IDE
Most QA engineers using the Selenium tool suite are familiar with the popular record and playback tool –?Selenium IDE. This Selenium IDE was earlier available just as a Firefox add-on. Later, it got deprecated with the introduction of the latest Firefox versions. This is because the add-ons in the latest Firefox (ver. 55) were standardized under the?Web Extension mechanism.
Relative Locators in Selenium 4 (Best upgrade)
Selenium 4 brings an easy way of locating elements with the inclusion of relative locators. This means testers can now locate specific web elements using intuitive terms that are often used by users like:
Improved Documentation
The documentation section has been revamped significantly with a neat UI for navigating to the desired section or page. This will help testers and developers find relevant information they need for a specific tool, language binding, etc.
Support for Chrome Debugging Protocol
Selenium 4 comes with native support for Chrome DevTools Protocol. This means QAs can now use Chrome development properties like Fetch, Network, Profiler, Performance, Application cache, and more. QAs can also leverage the APIs offered by Chrome DevTools to?simulate poor network conditions?and perform?geolocation testing.
Using this API will also help developers or QAs to test and resolve critical bugs for specific web-pages faster and on the fly.
Better Window/Tab Management in Selenium 4
There are several instances in test automation wherein one might need to open a particular link in a new tab or window to perform certain actions. To achieve this in Selenium 3, QAs had to create a new driver object and then perform the?switch operation?using the?WindowHandle method?to perform subsequent steps.
This is set to change in Selenium 4 as it comes with a new API –?newWindow?that allows users to create and switch to a new window/tab without creating a new WebDriver object.
领英推荐
Deprecation of Desired Capabilities
Desired Capabilities?were primarily used in the test scripts to define the test environment (browser name, version, operating system) for execution on the Selenium Grid.
In Selenium 4, capabilities objects are replaced with Options. This means testers now need to create an Options object, set test requirements, and pass the object to the Driver constructor.
Modifications in the Actions Class
This method is added to Actions class to replace the?moveToElement(onElement).click(). It is used to click on a certain web element.
This method will replace the?moveToElement(onElement).clickAndHold(). It is used to click on an element without releasing the click.
This method will replace moveToElement(onElement).contextClick(). It will perform the right click operation.
This method is added to replace?moveToElement(element).doubleClick(). It will perform a double click on an element.
This method (user for releasing the pressed mouse button) was initially a part of org.openqa.selenium.interactions.ButtonReleaseAction class. Now with the updated version of Selenium, it has been moved to Actions class.