LambdaTest Community

Find answers, support, and inspiration from other users

Questions
LambdaTest Community
Answered

How does the Selenium WebDriver work?

Can anyone please give me an explanation on how does the Selenium WebDriver work.

Up Vote Down Vote 0 Votes
Posted 3 months ago

Answers


Selenium WebDriver is also known as the Selenium 2.

Selenium WebDriver allows you to directly interact with the browsers through your automation test scripts. Java, PHP, C#, Python, Ruby, Perl, and Javascript are some of the programming languages it supports.

Selenium WebDriver supports Mozilla Firefox, Google Chrome version 12.0.712.0 and above, Internet Explorer, Safari, Opera version 11.5 and above, and HtmlUnit version 2.9 and above. As for operating systems, Selenium WebDriver supports Windows, Linux, Mac OS, and Solaris.

To understand the working of Selenium WebDriver, we need to first understand the architecture of Selenium WebDriver.

As you can notice in the image, Selenium WebDriver comprises of 4 main components:

  1. Selenium Client Libraries
  2. JSON Wire Protocol Over HTTP Client
  3. Browser Drivers
  4. Real Browsers Selenium Client Libraries

Selenium allows you to execute browser automation with these scripts written in any programming language with the help of Selenium Client Libraries. These Client libraries act as an interpreter between your test script & Selenium. They translate a test script written in any programming language to Selenese through language bindings. That way, Selenium is able to follow your given instruction irrespective of what language you chose to write your Selenium test scripts.

The major and most widely used Selenium bindings provided by the Selenium Project are their to help you with:

  • Java Selenium Testing
  • Python Selenium Testing
  • JavaScript Selenium Testing
  • C# Selenium Testing
  • Ruby Selenium Testing
  • PHP Selenium Testing

JSON Wire Protocol Over HTTP Client

Selenium allows you to automate browser testing. With Selenium WebDriver, you can execute browser automation by interacting directly with all of the major browsers such as Google Chrome, Mozilla Firefox, Safari, Microsoft Edge, Opera, and more. Every browser comprises a Browser Driver which has its own HTTP server.

JSON Wire Protocol is responsible for communicating with the browser drivers through their HTTP server. It fetches the information from Selenium Client Libraries and then relays it to the respective Browser Driver.

Browser Drivers

Each browser has a driver which is responsible for controlling the actions performed within that browser. After JSON Wire Protocol relays information to a Browser Driver, the Browser Driver controls the Browser to execute your Selenium test scripts automatically and sends the response in HTTP protocol through a HTTP server. Following are the Browser Drivers for the major web browsers:

  • ChromeDriver
  • FirefoxDriver
  • OperaDriver
  • SafariDriver
  • EdgeDriver

Browsers

Selenium Webdriver allows you to interact with various web browsers i.e. Google Chrome, Mozilla Firefox, Safari, Opera, Microsoft Edge, and more. Kindly note, Selenium helps you perform automated browser testing of your web applications and not native mobile apps. For that purpose, you have another open-source framework called Appium.

Up Vote Down Vote 0 Votes
Posted 2 months ago