Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Selenium WebDriver Architecture & Benefit

In this tutorial, we will learn Selenium WebDriver that is the successor of Selenium RC. In the earlier version of selenium, we needed Selenium RC server which must be started before executing the test scripts but WebDriver does not require any server to execute the tests on a particular browser.

There is a separate web driver for each browser that accepts the selenium commands and drives the browser under the tests. So, let us understand the Selenium Webdriver chapter in detail.

What is WebDriver?

WebDriver is an interface and a pure object-oriented tool. It is a web automation framework that was designed by Simon Stewart while he was working at ThoughtWorks. It is used to execute tests in different popular browsers such as Firefox, Chrome, IE, etc. It contains several types of abstract methods like get(), findElement(), By(), etc.

WebDriver is a set of APIs (Application Programming Interface) that provides a lot of capabilities to Selenium tool. It provides a communication facility between languages and browsers.

What is Selenium WebDriver?

Selenium WebDriver is a free and open-source library to automate web applications. It is the merger of two automation framework: Selenium and WebDriver.

In 2009, Selenium RC is merged with another testing framework called WebDriver to create a new Selenium tool known as Selenium 2.0 or Selenium WebDriver. It was released in July 2011. It is the first choice of any tester to automate web applications.

Selenium WebDriver Architecture

Selenium WebDriver Architecture consists of four basic components. There are as follows:
1. Selenium Language Bindings.
2. JSON Wire Protocol
3. Browser Drivers
4. Real Browsers.
The following picture shows the architectural representation of Selenium WebDriver.

Selenium WebDriver Architecture

Details of each component:

1. Selenium Language Binding/Selenium Client Libraries

Selenium tests can be written in multiple programming languages such as Java, Ruby, Python, etc. Therefore, Selenium Developers have decided to develop a language bindings or Selenium Client Libraries that allow selenium to support multiple languages such as Java, Ruby, Python, etc. 

Selenium Client Libraries is nothing but different kinds of Jar files. These client libraries contain Selenium WebDriver classes and methods that are needed to create automation test scripts and can be installed using package installers available with the respective languages.

For instance, suppose you want to use browser driver in Java, you will use the Java client libraries or Java jar files. All the supported Selenium client libraries can be downloaded from the official website ( of selenium.

👉 Selenium Client Libraries is not a testing framework. A selenium client library provides an application programming interface(API) i.e. a set of functions that executes the selenium commands from the program.


JSON stands for JavaScript Object Notation. It is a very popular data interchange format based on the subset of JavaScript Programming Language which was developed by Douglas Crockford.  

It is used to exchange the data between the client and server on the web. It supports data format available in all popular languages like Java, C#, Python, Ruby, etc.

JSON Wire Protocol is a transport mechanism created by WebDriver developers which transfers the data between a server and a client on the web. It uses a REST API  to transfer the information between HTTP server. Each browser driver such as FirefoxDriver, ChromeDriver, IEDriver, etc has its own HTTP server.

3. Browser Drivers

Selenium uses a specific driver for each browser to establish secure communication with the respective browser without revealing the internal logic of browser’s functionality. 

This browser driver receives the requests from the language binding and invokes the relevant operations on the browser. Each type of browser has its own driver that implements WebDriver’s wire protocol for that specific browser.

4. Real and Headless Browser

Selenium Web driver supports both real and headless browser. For example, If you want to automate tests with selenium web driver and execute the script in the real browser like Chrome, you have to download its specific driver application. 

This must be done for all browsers that you want to use. GeckoDriver (Firefox), ChromeDriver, and IE Driver are the example of the most frequently used driver and follow the guidelines of the Selenium framework.

The example of the headless browser is HTMLUnit browser(HTMLUnitDriver). Now let’s see how Selenium WebDriver works internally? 

How Selenium WebDriver works internally?

In realtime scenario, when you write code in your Eclipse IDE using any one of the supported Selenium client libraries (say Java), you will click Run option to execute the program source code.

After clicking the Run, Firefox browser will be launched and it will navigate to the URL of the website. Now let’s understand what is happening internally after clicking the Run till the launch of Firefox browser.

When you execute any test script using the web driver, the following steps are performed internally.
1. As you click on Run, The selenium client library run selenium commands from your own program and convert them into the JSON format (as shown below) and sends to the browser driver (say FirefoxDriver) for each command

https://localhost:7705/ {“url”: “”}in a serialized JSON format using JSON Wire Protocol over the HTTP.  Each browser driver uses the HTTP server to receive an HTTP request. 

2. JSON Wire Protocol communicates between the client and the server by transferring the data. The browser driver receives the HTTP request through HTTP Server. The HTTP Server performs all the specific actions or instructions on the real browser and then the browser will send a request to load URL. 

3. After performing all instructions, Execution status is sent back to HTTP Server over the HTTP. The browser driver again uses the HTTP server to receive the HTTP request and send back to the client library via JSON Wire Protocol. The client library passes it back to your program. The program will report as a success or failure.  

Features of Selenium WebDriver

There are so many important features of Selenium WebDriver. They are as follows:

Features of Selenium WebDriver
1. Multiple Browser Support: Selenium WebDriver supports a diverse range of multiple web browser and their version such as Firefox, Chrome, Internet Explorer, Safari, Opera, etc. It also supports Headless browser called HTMLUnit browser. HTMLUnit browser is a non-conventional browser.
2. Multiple Languages Support: WebDriver also supports most of the commonly used programming languages such as Java, C#, Python, Ruby, Pearl, PHP, JavaScript. You don’t have to know all of them. WebDriver provides facilities to choose any one of the programming languages based on competency and starts to create test scripts. 
3. Speed: WebDriver performs the faster operation as compared to other tools of Selenium Suite. Unlike Selenium RC, It does not require any intermediate server for communicating with the browser. It provides direct communication between the WebDriver Client Libraries and Web Browser.
4. Simple and Easy Commands: Selenium WebDriver provides very simple and easy commands to implement in the scripts. For example, If you want to launch the browser using web driver, the following commands have to use:

WebDriver driver=new FirefoxDriver(); (Firefox browser)
WebDriver driver=new ChromeDriver(); (Chrome Browser)
WebDriver driver=new InternetExplorerDriver(); (Internet Explorer Browser)

5. Drivers, Methods, and Classes: Selenium web driver offers multiple solutions to handle some potential challenges in automation testing. It also helps the testers in the easy way to handle with the complex type of web elements such as check boxes, drop downs, and alerts with the help of dynamic finders. 

6. Record & Playback: Web driver does not support record and playback features like Selenium IDE.

7. Dynamic Finder: It also supports dynamic finder for locating the web element on the web pages. 

Benefit/Advantage of Selenium WebDriver

Some of the most important advantages of Selenium WebDriver are as follows:

1. Selenium WebDriver is an open source, freeware, and portable tool.
2. It supports different operating system like Windows, Mac or Linux, etc. It also supports third-party tools such as AutoIt, Apache POI.

3. It supports parallel test execution that reduces the time taken in executing the parallel test cases.
4. Selenium web driver also supports iPhone and Android operating system.
5. It supports the implementation of Dynamic finder and Listener.

6. Starting up a server in WebDriver is not required before the execution of test scripts.
7. It can be integrated with third-party tools like TestNG and JUnit for grouping the test cases and generating test reports.

8. By using selenium web driver, we can achieve Continuous Testing by integrating with Maven, Jenkins, and Docker. 

Limitation/Drawback of Selenium WebDriver

There are some limitations that occur in selenium web driver. They are as follows:

1. Selenium WebDriver can be used only to test web-based applications. We can not test Windows-based applications or desktop applications and any other software. You will have to use a third-party tool like AutoIt for testing of Windows-based applications.

2. It is not possible to perform the testing on the image. We can perform image-based testing by integrating selenium with Sikuli.

3. WebDriver does not generate automatically test result file. We need to integrate with third-party frameworks like TestNG or JUnit for generating test reports.

4. WebDriver cannot support new browsers.
5. Selenium doesn’t support built-in add-ins assistance.

Selenium WebDriver Vs Selenium RC

There was a lot of limitations in Selenium RC which eventually led to the development of Selenium WebDriver. Let’s see how Selenium WebDriver differs from the Selenium RC.

Difference between Selenium WebDriver and Selenium RC

Selenium WebDriver
Selenium RC
1. The architecture of Selenium WebDriver is simpler as compared to the Selenium RC because it controls the browser directly from the OS (Operating System) level. 1. Selenium RC’s architecture is more complicated because it uses an intermediate Selenium Remote Control Server to communicate with the browser.
2. Selenium WebDriver performs faster as compared to the Selenium RC because it interacts directly with the browser without using any external proxy server. 2. Selnium RC is slower because it uses a JavaScript program called Selenium Core whose commands give the instructions to the browser.
3. Selenium WebDriver is pure object oriented API. 3. Selenium RC is semi object oriented API.
4. It supports both real and headless browser like HTMLUnit browser. 4. Selenium RC does not support headless browser. It supports only real browser.
5. WebDriver supports OS(Operating System) for mobile applications such as iOS, Windows mobile, and Android. 5. Selenium RC does not support testing of mobile apllications.
6. WebDriver supports Dynamic finder and Listener. 6. Selenium RC does not support.

Final words
Hope that this tutorial has covered almost all the important points related to the Selenium WebDriver architecture, features, benefits, and disadvantages. We have tried to understand you all topics in a simple process and an easy way. I hope that you will have understood this tutorial nicely and enjoyed it.

If you like and is a useful tutorial, please share it on social networks to your friends.
Thanks for reading!!!
Next ⇒ Download Selenium WebDriver⇐ PrevNext ⇒

The post Selenium WebDriver Architecture & Benefit appeared first on Scientech Easy.

This post first appeared on Scientech Easy, please read the originial post: here

Share the post

Selenium WebDriver Architecture & Benefit


Subscribe to Scientech Easy

Get updates delivered right to your inbox!

Thank you for your subscription