All of us belonging to the testing domain are familiar with Selenium, one of the most popular open source automation tools available in the industry. We were pretty excited in August 2018 when Simon Stewart, Selenium’s founding member officially announced the release date of Selenium 4 and what new features it will bring to the users.
The framework’s release got postponed just like it happened with Selenium 3. However, we have got our hands on the Alpha version of Selenium 4. We are really glad to see that they delivered some of the features in the Alpha version of Selenium 4 which they promised. Without any further delay, let’s get on knowing what is new in Selenium 4 and what we are getting in the Alpha release.
New Features Promised in Selenium 4
In the Selenium conference at Bangalore, Simon Stewart announced the following changes which are supposed to happen in Selenium 4.
Selenium 4 IDE TNG
The record and playback feature of Selenium is taken to a whole new level with advanced and rich features. Previously Selenium only used to support Chrome. But with new version i.e. Selenium 4, a plugin will allow you to run Selenium on any browser. Also, a user can now declare their own locator strategy.
There is also a new CLI runner which is based on Node JS, instead of the old HTML based CLI runner.
- It has the ability to execute test cases in parallel and provide information like passed and failed test cases, the time required, etc.
- The new IDE runner is completely based on WebDriver.
WebDriver API Became W3C Standardized
WebDriver API is not only used in Selenium but in multiple automation tools as well. Mobile testing tools like Appium depend heavily on it for web testing of mobile applications. The most highlighted change with new version of Selenium i.e. Selenium 4 is standardization of the WebDriver API with respect to W3C standards. This means it can now be implemented across different software without any compatibility issues.
Previously, when web testing was performed using Selenium 3, browser communication was performed via JSON wire protocol from the local end, which required API encoding and decoding. Not anymore though, as with Selenium 4, you won’t have to decode and encode your API request using W3C protocol. Java bindings, however, will be backward compatible while being focused on the W3C protocol. However, support for PhantomJS and Opera has been removed since WebDriver implementation for those browsers are not anymore developed.
Mostly because of the W3C standardization of WebDriver, the release date of Selenium 4 got postponed. But keeping in mind the new features, it’s worth waiting. Once the specification is complete, the remaining job will fall on the hand of browser vendors who will decide on how they are going to implement the new WebDriver API. This is a more logical approach since the internal architecture of browsers is better known by the vendors.
Comes With an Improved Grid
If you have worked with Selenium earlier, you must have faced the configuration challenges and the issues that arise when you try to set it up for the first time. Selenium Grid version 4 makes you free from the installation worries. It allows you to execute test cases in parallel on multiple browsers, systems as well as operating systems. The 2 main elements of the new Selenium Grid are:
A test machine on which you can execute the test cases.
The server acting as a central point to control all other machines available in the network. Selenium Grid has only one hub whose purpose is to allocate the test case execution to a specific node.
Till version 3, testers faced a lot of difficulties while connecting hub with nodes. But in new version Selenium 4, the process is much easier. The moment you start the Selenium Grid, it will act as both node and hub. There is also better Docker support and no chance of thread safety bugs. The new Selenium 4 Grid server also allows the user to output logs in a single line format in JSON.
A Better UI
A user-friendly interface is a must-have feature for all applications. Selenium has done a lot to improve its UI in the latest version, Selenium 4. The grid UI is more user-friendly having relevant information about the capacity to execute test cases or details about the sessions that are running etc.
Logging with hooks and request tracing is also improved since debugging or observability is no longer for DevOps only. Automation testers will now have a better hold on debugging with the improved UI.
Much Detailed Documentation
Documentation is very important for any project to succeed. Since the release of Selenium 2, the documents were not updated for years. Meaning, anyone willing to learn Selenium had to rely on the old tutorials, in which many of the features changed in version 3.
With Selenium 4, SeleniumHQ promised us to deliver a refreshed and updated documentation which is the most anticipated update among test automation engineers.
What Is So Promising In The Alpha Version Of Selenium 4?
The alpha version of Selenium was released on April 28, 2019, & came with many promised features. Let’s see what those are.
- Selenium interacted with browsers using Backend APIs. The architecture of those APIs changed internally.
- Automation scripts developed using Selenium 2 and 3 will not be impacted.
- WebDriver IDE’s W3C recommended document is now available which provides a detailed and neatly arranged API information.
How To Get Your Hands On Selenium 4 Alpha?
Although Selenium 4 Alpha is not officially released at the website of Selenium, you can still get it from MVN Repository.
However, it should be kept in mind that the Alpha version of Selenium 4 is still in the testing phase and there may be some instability. You can use it if you want to get hands-on with the new features but if you want to implement them in your project, our suggestion is to wait for some time until a stable version is released. If you already have experience working with the alpha version, do let us know the features you found most interesting along with the stability issues that you faced in the comments.
Published on Java Code Geeks with permission by Arnab Roy Chowdhury, partner at our JCG program. See the original article here: What To Expect From The New Version Of Selenium 4 Alpha?
Opinions expressed by Java Code Geeks contributors are their own.