top of page
Search
Writer's pictureTuyen Nguyen

Selenium WebDriver - How it works

Updated: Dec 27, 2022

What is Selenium WebDriver


Selenium WebDriver is the most important component of Selenium Tool's Suite. It is a web automation framework that allows you to execute your test against different browsers like Firefox, Chrome, IE,...


In WebDriver, test scripts can be developed using any of the supported programming languages and can be run directly in most modern web browsers.


Selenium WebDriver performs much faster as compared to Selenium RC because it makes direct calls to the web browsers. RC, on the other hand, needs an RC server to interact with the browser.


Architecture of Selenium WebDriver


Selenium WebDriver Architecture

The above picture illustrates an idea about the working of Selenium WebDriver.

There are four basic components of WebDriver Architecture:

  • Selenium Language Bindings

  • JSON Wire Protocol

  • Brower Driver

  • Real Browser

Let's examine each component in more detail.


Selenium Language Protocol


As mentioned earlier, developers can use Selenium to write test code in different languages like C#, Java, Python, Perl, etc. So Selenium developers have built language bindings/Selenium Client Libraries in order to support multiple languages. For instance, if we use the browser driver in Java, it will use the Java bindings.


JSON Wire Protocol


JSON Wire Protocol facilitates the transfer of data between the Client & Server. It is the REST (Representational State Transfer) based API. Each browser will have its own HTTP server.


Browser Driver


Selenium uses drivers, specific to each browser in order to establish a secure connection with the browser without revealing the internal logic of the browser's functionality. Each browser has its corresponding Browser Driver.

When we execute a test script using WebDriver, the following operations are performed internally.

  1. For each Selenium command, an HTTP request is generated.

  2. This HTTP request is sent to the Browser Driver by JSON Wire Protocol.

  3. The Browser Driver receives the HTTP request through HTTP Server (Browser Driver has its own HTTP Server).

  4. HTTP Server decides all the steps to perform which are executed on Real Browser.

  5. Execution status is sent back to HTTP Server which is subsequently sent back to the automation script.


Real Browser


The browser supported by Selenium WebDriver:

  • Google Chrome

  • Firefox

  • Internet Explorer

  • Edge

  • Safari

So, that was, in brief, the entire architecture of Selenium Webdriver

119 views0 comments

Comments


bottom of page