Selenium has been the undisputed leader in automated cross-browser testing. It keeps bringing new features from its first 1.0 release to the latest one which is 4.0. In this short tutorial, we’ll highlight Selenium version 4 features. The new changes provide testers with clearer, more stable, and efficient tests across an array of browsers.
What’s New in Selenium Version 4?
- Increased Compliance
- Selenium Grid Makeover
- Revamped Selenium IDE
- Relative Locators
- Better Documentation
- Bid Adieu to Desired Capabilities
- Evolution of Actions Class
- More Reference
- Wrapping Up Selenium Version 4 Features
This new Selenium 4 release bundles many new features. Let’s take a deeper look at the brand-new additions.
Selenium 4.0 makes your web tests more reliable across different browsers. They now follow a common standard, making things simpler and smoother.
Full W3C Compliance
In Selenium 4.0, there is no more need for encoding and decoding through the JSON wire protocol. Instead, it now fully supports the W3C standard which means test scripts can now directly interact with browsers. This change makes a test case more stable and consistent. Popular drivers like Chrome and Gecko also incorporated the same W3C guideline.
End of Support for Opera and PhantomJS
The new version has ended the native support for Opera and PhantomJS. They won’t have any compatible web drivers either. However, automation testers can still use Chrome for testing Opera. It is because the latter uses chromium as its core. On the other hand, those using PhantomJS can utilize the headless mode with Chrome or Firefox.
Selenium Grid Makeover
The new Selenium version 4 features a powerful Grid to improve parallel test execution.
Spinning up Selenium Grid is now a breeze with Docker container support. Enjoy faster scaling and seamless integration with Kubernetes.
Managing the Grid has never been easier. The user-friendly GUI helps you visualize and control your testing infrastructure effortlessly.
HTTPS and IPv6 Enabled
Embrace modern protocols and network configurations with support for HTTPS and IPv6 addresses.
Revamped Selenium IDE
The new IDE is back as a Firefox and Chrome add-on, letting you record and playback tests across popular browsers.
New SIDE tool
The updated IDE includes a SIDE tool, a.k.a. Selenium IDE runner. It enables QAs to run their projects on node.js. This tool allows for cross-browser tests either locally or on Cloud Selenium Grid.
Enhanced Control Flow
Write robust tests with improved “while” and “if” conditions, and benefit from a backup strategy for element location.
Generate test cases in various languages like Java, Python, and C# for seamless integration with your testing frameworks.
Selenium 4 brings in a new set of locators on board known as relative locators. It refers to the use of the following shortcuts to specify the visual position of web elements. The keywords are ‘to the left of,’ ‘to the right of,’ ‘above,’ and ‘below’.
The documentation section receives a facelift. It has a clean UI for effortless navigation. This enhancement serves as a valuable resource for testers and developers. They can now quickly access info on Selenium tools, language bindings, and more.
Bid Adieu to Desired Capabilities
Selenium 4 bids adieu to Desired Capabilities, introducing Options in their place. Testers now create Options objects to define browser-specific capabilities, streamlining the process and enhancing flexibility.
Evolution of Actions Class
The Actions class in Selenium 4 undergoes significant expansion with the introduction of new methods. These include:
click(WebElement) – It backfills the moveToElement’s click method to perform the click action.
clickAndHold(WebElement) – It is an alternative to moveToElement’s click and hold to perform click action.
contextClick(WebElement) – It provides a new way of calling the moveToElement’s context-click method for the right-click sequence.
doubleClick(WebElement) – It is the modern version of moveToElement’s double-click method mimicking the double-click action.
release() – It brings the mouse button from pressed to normal state. In old Selenium, it was under the ButtonReleaseAction class but now shifted to the Actions class.
Each of the above methods adds a new dimension to simulating mouse and keyboard actions. With this change, testers will now have more precise control over their test cases.
Refer to these awesome tutorials for additional perspective.
1. What is Regression Testing? How to Do It? Provide Examples.
2. What is Penetration Testing? How to Do It? Provide Examples.
3. What is the Software Development Life Cycle (SDLC)?
4. What is the Software Testing Life Cycle (SDLC)?
5. How to Generate Report in Selenium Webdriver?
6. How to Generate Extent Report in Selenium?
7. How do I Merge Two Extent Reports?
8. How to Zoom In/Out in Selenium Webdriver Using Java?
9. Random API for Postman to Generate Random Inputs
10. Differences Between Extent Report and Allure Report
11. How to Inspect Element on Mac, Android, and iPhone
Wrapping Up Selenium Version 4 Features
Selenium 4 makes web testing better by working well with different browsers. It’s easier to create efficient test scripts with simpler automation. Following the W3C WebDriver standard ensures consistent testing across browsers. New features, like better error messages and improved locators, make testing more reliable and user-friendly. Overall, Selenium 4 is a big upgrade, making web automation simpler and more effective.