Selenium 4 is all set to release this Christmas. Simon Stewart
(a founding member of Selenium) officially announced it at the recently held Selenium conference in Bangalore. Some major changes in the upcoming Selenium version 4 have been revealed. It’s time to get ahead of the curve and figure out what is going to be changed, added, and deprecated. In this article, we will take a look at a few important features and give some insight on updates you can expect for your automation framework.
W3C WebDriver Standardization
The Selenium 4 WebDriver will be completely W3C Standardized. The WebDriver API has grown to be relevant outside of Selenium. It is used in multiple tools for automation. For example, it’s used heavily in mobile testing through tools such as Appium and iOS Driver. The W3C standard will encourage compatibility across different software implementations of the WebDriver API.
Let’s take an example of how Selenium Grid communicates with Driver executables as of now –
Adopting New Protocol
A test in Selenium 3.x, on the local end (through JSON wire protocol) communicates with the browser at the End node. This requires encoding and decoding of the API. In Selenium 4, the test will directly communicate without any encoding and decoding of API requests (through the W3C Protocol), though Java bindings will be backward-compatible, but focusing more on the W3C Protocol. The JSON wire protocol will no longer be used.
There are multiple contributors in the WebDriver W3C specs. All of the work done is on GitHub
Selenium 4 IDE TNG
Selenium IDE support for Chrome is in the bucket. As we all know, Selenium IDE is a record and playback tool. It will now be available with much richer and more advanced features, such as
- New plugin system – Any browser vendor will now be able to easily plug in to the new Selenium IDE. You can have your own locator strategy and plug in the Selenium IDE.
- New CLI runner – It will be completely based on node.js, not the old HTML-based runner. It will have the following capabilities:
- WebDriver Playback – The new Selenium IDE runner will be completely based on WebDriver.
- Parallel execution — The new CLI runner will also support parallel test case execution and will provide useful information like time taken and number of test cases passed/failed.
Improved Selenium Grid
Those who have worked with Selenium Grid know how difficult it is to set up and configure. Selenium Grid supports test case execution on different browsers, operating systems, and machines, providing parallel execution capability.
There are two main elements in Selenium Grid: Hub and Node.
Hub acts as a server, a central point to control all the test machines in a network. In Selenium Grid, there is only one hub, which allocates test execution to a particular node based on capability matches.
Node is a test machine where test cases actually run.
For more details on Selenium Grid, follow the tutorial here
The typical process to set up Selenium Grid has caused testers sometimes to face difficulty in connecting the node to the hub.
In Selenium 4, the Grid experience is going to be easy and smooth. There will not be any need to set up and start the hub and node separately. Once we start Selenium Server, the Grid will act as both hub and node.
Selenium 4 will come up with a more stable Selenium Grid in terms of removing all thread-safety bugs, and better support for Docker.
Better Selenium Grid UI
Selenium 4 will come with a more user-friendly UI for Grid, with relevant information about sessions running, capacity, etc.
“Passive observability is the ability to do descriptive tracing.” – Simon Stewart
Observability, logging, and debugging are no longer confined to DevOps in recent times. As part of this release, request tracing and logging with hooks will be improved so as to provide automation engineers a hold on debugging.
Documentation plays a key role in any project’s success. The Selenium docs had not been updated since the Selenium 2.0 release. In the latest upgrade, Selenium’s documentation is also going to be refreshed and detailed. You can access it here
Here’s a video from Selenium Conference 2018, held at Bangalore recently:
Selenium 4 in a Nutshell
Upgrading to the latest version of Selenium should not require any code changes. Setting up nodes and hubs will become smooth and the entire grid experience is going to be streamlined. For automation engineers, the latest version should not be challenging and existing automation frameworks should work with minimal changes.