Selenium WebDriver Architecture

Share This Article

Selenium is a browser automation tool, commonly used for writing end-to-end tests of web applications. A browser automation tool does exactly what you would expect: automate the control of a browser so that repetitive tasks can be automated. At a very high level, Selenium is a suite of three tools.

Selenium IDE is an extension for Firefox that allows users to record and playback tests. The record/playback paradigm can be limiting and isn’t suitable for many users.

Selenium WebDriver provides APIs in a variety of languages to allow for more control and the application of standard software development practices.

Selenium Grid makes it possible to use the Selenium APIs to control browser instances distributed over a grid of machines, allowing more tests to run in parallel.

In this article let’s see the Architecture of Selenium WebDriver.

Selenium WebDriver:

Selenium-WebDriver makes direct calls to the browser using each browser’s native support for automation. Since there are so many browsers & so many programming languages there is need for common specification which will be provided by WebDriver API. Each browser has to implement this API which is called as Remote WebDriver or Remote WebDriver Server. At a higher level Selenium WebDriver architecture look like this.

Selenium Architecture

WebDriver Architecture

The language binding will send the commands across the common driver API, on the other end there is going to be a driver listening to those commands and they will be executed in browser using remote WebDriver and it’s going to return the result/response via API to the code/Binding.

Actually whatever the commands issued in the code will be interpreted into Webservice methods (JSON Wired Protocol) and the Remote Driver will receive the HTTP request (commands) and execute them in the browser then send the response back.

Json Wire Protocol

Example:

Let’s take a sample code and see how the data flows between Client bindings, Server.

driver.get("http://www.google.com");

The client library, as soon as it receives the preceding command, will convert it to the JSON format (shown below) and communicate with the Firefox Driver/Remote WebDriver.

http://localhost:7705/ {     "url": "http://www.google.com" }

 

Firefox Driver will speak to the Firefox browser natively, and then the browser will send a request for the asked URL to load.

 

Share This Article
Loading Facebook Comments ...

Leave a Reply

Your email address will not be published.