Selenium 4 Architecture
Selenium 4 Architecture
Table of Contents
W3C WebDriver Protocol .............................................................................................................................. 2
Components .............................................................................................................................................. 2
Direct ..................................................................................................................................................... 2
Remote .................................................................................................................................................. 4
Advantages................................................................................................................................................ 5
Standards .............................................................................................................................................. 5
Stability ................................................................................................................................................. 5
Actions API ............................................................................................................................................ 6
Mobile Automation ................................................................................................................................... 6
Cloud Platforms......................................................................................................................................... 6
Page 1 of 6
W3C WebDriver Protocol
The W3C WebDriver Protocol has at least 3 advantages. #1 It provides standards #2 It provides stability
and #3 It provides an updated Actions API that is supplied with better resources. I will talk about all 3
and get straight to the point.
If you are interested in more videos, you can subscribe to my YouTube channel and click the bell icon.
You can also follow me on Twitter, connect with me on LinkedIn and Facebook. I will also place the
transcript and presentation slides on GitHub.
In this session, I am going to speak about the Selenium 4 Components, Advantages, Mobile Automation,
and Cloud Platforms.
Components
Starting with the components, Selenium has moved from 3 to 4 because of the W3C WebDriver
Protocol. This is an example of Selenium 3 which includes the JSON Wire Protocol. The objective of JSON
Wire Protocol was to transfer information from the client to the server. That information was processed
over HTTP by sending HTTP Requests and receiving HTTP Responses.
Direct
With Selenium 4, the JSON Wire Protocol has been removed from the new architecture. Now, there is
direct communication between the Browser Drivers and Selenium Client & WebDriver Language
Bindings. The 1st component has 2 parts combined into one. Selenium Client is a separate part and
Page 2 of 6
WebDriver Language Bindings is a different part. Selenium is an API that have commands for automating
our browser. WebDriver has only 1 job and that job is talk to the browser through a driver.
Each language has their own bindings. Bindings mean the same commands written for Java is also
written for C#, Python, Ruby, and JavaScript. You may have noticed that Selenium added support for the
W3C protocol starting at version 3.8. According to Simon Stewart, in this Selenium 4 Webinar with
BrowserStack, he mentioned the versions of Selenium since 3.8 have spoken to both JSON Wire Protocol
and W3C Protocol. After running your Test Script, look for INFO: Detected dialect: W3C to see if your
Selenium version is speaking to W3C. Both of these screenshots show W3C for Selenium 3.8 and
Selenium 4. If not W3C then it will show OSS which means Open Source Software.
Back to our diagram, we see the 2nd component is Browser Drivers and it have 2 functions. The first
function is to receive a request from Selenium Client & WebDriver Language Bindings then pass that
request to the browser. A driver also known as a proxy is responsible for controlling the browser. The
second function is to return a response from the browser back to the Selenium Client & WebDriver
Language Bindings. All of the drivers use the W3C WebDriver Protocol and most of them are created by
the browser vendors.
When it comes to the 3rd component Web Browsers. This is where all of the Selenium Commands are
performed. The browser receives a request, performs the request, and sends back a response to the
driver. Also, notice how Opera is not available as a driver or browser. In reality, they are still available
but I did not add them because the WebDriver implementations are no longer under development so
native support has been removed for Opera and Phantom JS.
Page 3 of 6
Remote
Remote is another form of communication to the browser. It can happen through the RemoteWebDriver
or Selenium Server. The RemoteWebDriver is a class that implements the WebDriver Interface. With
Selenium 4, FirefoxDriver and SafariDriver continue to extend RemoteWebDriver. However,
ChromeDriver and EdgeDriver no longer extend RemoteWebDriver but they extend ChromiumDriver. In
the introduction, I showed how ChromiumDriver, FirefoxDriver, InternetExplorerDriver, OperaDriver,
and SafariDriver all extend RemoteWebDriver. We see 3 of the boxes (RemoteWebDriver, Browser
Drivers, and Web Browsers) are gray because they all run on the same system.
The Selenium Server is different. It’s a way to communicate remotely when talking to the driver but not
on the same system as the driver. That’s why Selenium Server is a different color. We start the server by
using the Selenium Standalone jar file. After it starts, the server directs our Test Scripts to a remote web
browser.
Page 4 of 6
Advantages
Standards
For W3C WebDriver Protocol, the advantages are Standards, Stability, and Actions. W3C stands for
World Wide Web Consortium which is an international group of people that create long term standards
for the web. With that 1st advantage of standards, our Test Scripts run consistently on each browser.
There were times with Selenium 3 that some commands performed offbeat on different browsers. Since
Selenium 4 is compliant with W3C WebDriver, there is no more required encoding and decoding of the
API request.
Stability
The second advantage is stability. I believe backward compatibility is the main benefit of stability. Per
Simon Stewart, they are fully aware that some people will want to use the old JSON Wire Protocol. So,
the Java Bindings and the Selenium Server will provide mechanisms for people to use the old JSON Wire
Protocol. They know, we have spent time, we have spent effort, and we have been dedicated to building
up our Test Suite. Therefore, our Test Suite will remain smooth for Selenium 4. No changes to our Test
Scripts unless an API has been marked deprecated. Deprecated API’s like the FindsBy Interfaces have
been removed from Selenium 4. As a result, the WebDriver API’s are going to continue working like
there was never a change to Selenium.
Page 5 of 6
Actions API
The updated Actions API is the third advantage. With this API, we can handle keyboard and mouse
events like double clicking an element. It’s an advantage because Selenium 4 offers a way to perform
more than 1 action at the same time like pressing 2 keys. That’s an advantage for UI Automation.
Mobile Automation
For Mobile Automation, Appium is the tool used for automating mobile applications. We see on
Appium.io site, the introduction shows native, mobile web, and hybrid application on iOS mobile,
Android mobile, and Windows desktop platforms. The Appium client library have implemented elements
of the W3C Protocol.
Cloud Platforms
Also, Cloud Platforms such as SauceLabs and BrowserStack support W3C WebDriver. However, the
format of their capabilities will change. You can go to their site to see what capabilities need to be
updated. Here’s the page for BrowserStack with an Introduction section, talk about Why changes are
being made, What does it mean to me, Updating the Selenium tests, and an Example section that show
how capabilities are passed with W3C Protocol. SauceLabs have a page that shows W3C Capabilities
Support with sections: What You Will Need, Verifying the Capabilities, W3C WebDriver-Compliant,
Instantiating WebDriver with W3C, and Common Test Script Configuration Errors To Avoid. That’s it for
the W3C WebDriver Protocol. Don’t forget to Connect and Subscribe. Next, I will demo the Relative
Locators which locate elements based on their relationship to another element.
Contact
✔ 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/
Page 6 of 6