logo logo

Selenium 3 vs. Selenium 4

main post image

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

The architecture for Selenium 3 includes the JSON Wire Protocol. However, Selenium 4 does not include the JSON Wire Protocol, and that’s the contrast between Selenium 3 and Selenium 4. JSON stands for JavaScript Object Notation.

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:

Selenium 3 Architecture

Selenium 4 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:

Selenium 3 vs. Selenium 4: Selenium 4 Architecture (Direct)

The Selenium Client & WebDriver Language Bindings is a part of the architecture where each language has their own unique bindings. Bindings mean that the same commands written for one language are also written for another language. For example, Java has a set of commands that have also been written for other languages (C#, Python JavaScript, and Ruby).

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:

The relationship between each driver

ChromeDriver

EdgeDriver

ChromiumDriver

Selenium 4 Advantages

With the upgrade, Selenium 4 successively gained at least 3 advantages. The advantages are:

  • Standards
  • Stability
  • 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 4 New Features

The new features in Selenium 4 involve Selenium IDE, Selenium WebDriver, and Selenium Grid 💪

  • 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.

Conditionals

  • if
  • else-if
  • else
  • end

Loops

  • do-repeat if
  • while
  • times
  • forEach

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.

(Video) Selenium 3 vs. Selenium 4

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 ✨

 

Rex Jones II

About the author

Rex Jones II

Rex Jones II has a passion for sharing knowledge about testing software. His background is development but enjoys testing applications.

Rex is an author, trainer, consultant, and former Board of Director for User Group: Dallas / Fort Worth Mercury User Group (DFWMUG) and member of User Group: Dallas / Fort Worth Quality Assurance Association (DFWQAA). In addition, he is a Certified Software Tester Engineer (CSTE) and has a Test Management Approach (TMap) certification.

Recently, Rex created a social network that demonstrate automation videos. In addition to the social network, he has written 6 Programming / Automation books covering VBScript the programming language for QTP/UFT, Java, Selenium WebDriver, and TestNG.

✔️ YouTube https://www.youtube.com/c/RexJonesII/videos
✔️ Facebook http://facebook.com/JonesRexII
✔️ Twitter https://twitter.com/RexJonesII
✔️ GitHub https://github.com/RexJonesII/Free-Videos
✔️ LinkedIn https://www.linkedin.com/in/rexjones34/

Join TestProject Community

Get full access to the world's first cloud-based, open source friendly testing community. Enjoy TestProject's end-to-end test automation Platform, Forum, Blog and Docs - All for FREE.

Join Us Now  

Leave a Reply

popup image

Become a master for Selenium testing

Getting started with web testing? We’ve got you covered with a FREE ready-to-go test automation platform that’s already bundled up with Selenium to simplifying and enhancing your experience.
Get Started
FacebookLinkedInTwitterEmail