Selenium Architecture

We’re talking about Selenium 4, since it is the latest one.

Architecture of Selenium 4 and 3 are pretty much the same, but in Selenium 4 WebDriver we are now using the W3C Protocol (Selenium 3 WebDriver used JSON wire protocol).

What’s W3C?

W3C stands for the World Wide Web Consortium, an international community that develops and maintains standards and guidelines for the World Wide Web. The main aim of the W3C is to ensure the long-term growth and interoperability of the Web.

The switch from JSON wire protocol to the W3C standard has let to more stability, enhanced browser compatibility, performance and efficiency as there is no overhead of HTTP requests and responses for communication between the WebDriver client and the browser driver. Instead, WebDriver now utilizes native browser communication channels and protocols.

How does selenium really work?

1

Script Creation

You write an automation script in your preferred client language (java, python etc)

2

Command Initiation

The client library translates your script into commands and sends them to the WebDriver using the JSON wire protocol

3

Browser Driver interaction

The WebDriver forwards the command to the appropriate browser driver like ChromeDriver.

4

Browser Execution

The Browser driver communicates with the real browser, executing the commands like opening a webpage, clicking a button etc

5

Response

The browser sends the results like page title, element attributes back through the browser driver, WebDriver, and client library to your script.

Updated on