In this article, I will compare the architecture for Selenium 3 vs Selenium 4, then highlight a few Selenium 4 advantages. I will also discuss the new features in Selenium 4 that have been applied to Selenium IDE, Selenium WebDriver, and Selenium Grid.
The biggest difference between Selenium 3 and Selenium 4 involves W3C WebDriver Protocol, which is the main reason for Selenium’s upgrade. W3C is acronym for World Wide Web Consortium, which is an international community that develops web standards. The WebDriver Protocol is responsible for controlling a web browser’s behavior.
Here is a breakdown of the article:
- Selenium 3 Architecture
- Selenium 4 Architecture
- Selenium 4 Advantages
- Selenium 4 New Features
- (Video) Selenium 3 vs. Selenium 4
The JSON Wire Protocol has an assignment to transfer information from the client to the server over HTTP. HTTP is an acronym for Hyper Text Transfer Protocol. A Selenium request is sent from the Selenium Client and WebDriver Language Bindings component. Next, the request is received by JSON Wire Protocol Over HTTP, then secured by the Browser Driver.
Afterwards, the request command is delivered to a Web Browser where the automation takes place. When the automation is complete, a response travels back to the Browser Driver, JSON Wire Protocol, and Selenium Client & WebDriver Language Bindings. Here is a diagram displaying Selenium 3 Architecture:
Unlike Selenium 3, Selenium 4 has direct communication between the client and server. The client still has 2 parts (Selenium Client & WebDriver Language Bindings) while Browser Drivers are the server.
- Selenium Client sends out a request to perform a command.
- The WebDriver Language Bindings is a code library designed to drive actions.
- Browser Drivers receive the request and then return a response after an automation Test Script executes on the Web Browser:
When it comes to the Browser Drivers and Web Browsers, WebDriver drives each browser using the browser’s built-in automation support. A Browser Driver such as ChromeDriver controls the Chrome browser.
In Selenium 4, a change was made to the drivers. ChromeDriver and EdgeDriver extend ChromiumDriver while RemoteWebDriver is the parent to ChromiumDriver. Here are some screenshots showing the relationship between each driver:
With the upgrade, Selenium 4 successively gained at least 3 advantages. The advantages are:
- Updated Actions API
The standards are an advantage because our Test Scripts run more consistently on each browser. All browser vendors have a standard. Since Selenium 4 is compliant with W3C WebDriver, there is no more required encoding and decoding of the request.
Stability is another advantage because of backwards compatibility. The Java Bindings and the Selenium Server provide a mechanism to use the old JSON Wire Protocol. There have been updates to the Actions API for keyboard and mouse events. It supports a way to carry out more than one action at the same time, like pressing 2 keys.
- Selenium IDE allows us to record, playback the recording, edit, and debug our test.
- Selenium WebDriver is an API that executes our test by driving a browser for automating an Application Under Test (AUT).
- Selenium Grid executes our test across multiple browsers, operating systems, and machines.
Selenium IDE acquired Backup Element Selectors and Control Flows. The Backup Element Selectors record multiple locators for each element. Control Flows assist with executing statements in Selenium IDE. The Control Flows are Conditionals and Loops.
- do-repeat if
In addition to the W3C WebDriver Protocol, Selenium WebDriver has new features that include Chrome DevTools, Relative Locators, multiple ways to capture a screenshot, and manage a window. Selenium Grid provides a new approach to setting up an infrastructure of browsers and operating systems. The initial grid was released in 2011, however now it’s more modern. Three chapters were written to dive deeper into the Selenium 4 New Features for Selenium IDE, Selenium WebDriver, and Selenium Grid.
The following video compares Selenium 3 and Selenium 4 Architecture 🎬
These were the differences between the architecture for Selenium 3 vs Selenium 4,
and some of the Selenium 4 advantages and new features.
Share in the comments below your most anticipated feature in Selenium 4 ✨