Selenium WebDriver Tutorial

Seleniun WebDriver Introduction

  • Selenium WebDriver is the essential tool of Selenium Tool Suite because it can directly communicate the browser without any server. 
  • Selenium WebDriver is a browser automation framework that accepts commands and sends them to the browser.  
  • It was developed by JSON Huggins and Simon Stewart from Google Company in 2008.
  • Web driver is implemented through a browser-specific driver
  • Selenium WebDriver comes under Selenium version 2, which provides a simple and brief programming interface. 
  • Selenium2= WebDriver+ Selenium 1.0, where selenium 1.0 version includes Selenium IDE, Selenium RC and Selenium Grid.
  • WebDriver is a collection of core java libraries and interfaces.
  • The Selenium WebDriver test scripts can be developed by any supported programming languages and can be run directly in web browsers.
  • The programming languages that are supported by WebDriver include C#, Java, Perl, PHP, Python, and Ruby.
Web driver Introduction

WebDriver execution is faster as compared to Selenium RC because selenium RC needs a selenium server to interact with the browser whereas WebDriver directly interacts with the web browser without any need of selenium server.

Before going further to the concepts of Selenium WebDriver, we should know any supported programming languages. Presently, Selenium WebDriver is in demand with Java and C#.

Here, we are performing a Selenium WebDriver with the java programming language.

To learn basic and advanced concepts of java and C# programming language, you can refer to the below links:

Java Tutorial:

C# Tutorial:

Firefox (Gecko Driver) WebDriver has a built-in implementation. And we need plug-ins to other browsers for specific drivers to communicate and run the test scripts.

Browsers supported by WebDriver is as following:

  • Google Chrome Browser
  • Mozilla Firefox
  • Internet Explorer Browser
  • Safari Browser
  • Microsoft Edge Browser
Web driver Introduction 1

Architecture of Selenium WebDriver

There are four necessary components of Selenium WebDriver Architecture:

  • Selenium Language Bindings
  • JSON Wire Protocol
  • Browser Drivers
  • Real Browsers
Web driver Introduction 2

Selenium Language Bindings/Client libraries:

Selenium supports multiple languages like Java, Ruby, Python, etc.; Developers have developed language bindings to allow Selenium to support various libraries. Once you go through the test (the complete selenium code), which we have written, that has to be converted into JSON format.

We can download the supported language bindings with the help of the below link.

JSON Wire Protocol:

JSON stands for JavaScript Object Notation. It is used to exchange data on the web. JSON files are sent to the browser driver, which is also known as the server through HTTP protocol. And each Browser Driver like- Firefox Driver, Chrome Driver, has its HTTP server.

Note: Each browser contains a separate browser driver.

Browser drivers:

Selenium WebDriver are specific to each browser and establish a secure connection with the browser without disclosing any internal functionality of the browser.

The browser driver communicated with its respective browser and executed the command by interpreting JSON, which is a receiver on the browser. And response will go back in the form of http.

While executing a test script with the help of WebDriver, the following activities performed internally:

  • For each Selenium command, the HTTP request generated and sent to the browser driver.
  • The driver receives the HTTP request with the help of the HTTP server.
  • The HTTP Server performed all the steps and instructions which are executed on the browser.
  • In the last activities, the execution status sent back to the HTTP Server.

Real Browsers:

The browser driver receives a response from the browser and JSON response to the client.

Browsers supported by Selenium WebDriver:

  • Internet Explorer
  • Mozilla Firefox
  • Google Chrome
  • Safari
  • Microsoft Edge

Selenium Web-driver Topics