Selenium 4 has been revamped with one major change and that's the W3C WebDriver Protocol.
This diagram is a snapshot of Selenium's 3 architecture.
Do you see the second component, JSON Wire Protocol? Its role is to transfer information from the client to the server. That information is passed over an HTTP.
HTTP is an acronym for hypertext transfer protocol. We see it sends HTTP requests and receives HTTP responses. This component has been removed from the new architecture.
Now there is direct communication between the client and server.
As a result, the W3C WebDriver Protocol has at least 3 advantages.
For standards, the W3C, which stands for World Wide Web Consortium, is an international group of people that creates long term standards for the web. Therefore, our automation test scripts will run consistent on each browser. Since Selenium 4 is compliant with W3C WebDriver, we have no more required encoding and decoding of the API request.
The key advantage for stability is backward compatibility.
It is no problem for people who want to still use the old JSON Wire Protocol. Selenium became compliant with W3C and Selenium 3. That's why it still works in Selenium 4.
The Java bindings and Selenium server provides a mechanism for us to use JSON wire protocol with the updated actions API. We can manage keyboard and mouse events.
It's an advantage because now Selenium 4 offers a way to perform more than 1 action at the same time, like pressing 2 keys.
Now, when it comes to Selenium 4, we see it has direct communication. There are 3 components.
The first component has 2 parts combined into one — Selenium Client is a separate part and WebDriver Language Bindings is a different part.
The second component is Browser Drivers, and we see it has 2 functions.
The third component is Web Browsers.
For our test scripts, we are going to use Chrome. But the other major browsers are Firefox, Safari, and Edge. This is where all of the Selenium commands are performed.
Here's the process. The browser receives a performance request and sends back a response to the driver.
Next, I will demo the relative locators, which locate elements based on their relationship to other elements.