General Topic Information Technology Software Testing

Test Automation – How Selenium WebDriver works?

Welcome to brand new series on Test automation with Selenium. In this series, we will have a look at how we can automate testing of web application with Selenium.

Selenium is popular open source test automation tool. With Selenium, we can automate test scenarios related to black box testing, compatability testing, system testing, api testing, and regression testing.

Selenium Project has 3 flavours Selenium IDE, Selenium WebDriver, and Grid. Out of which WebDriver API is very popular in automation.Today I am going to focus on Selenium WebDriver.

How Selenium WebDriver works ?

Using WebDriver, we can drive browser and perform actions like Click, Open URL, Enter text, take screenshot etc.Typical test automation utilizes WebDriver API, language specific driver bindings, and test framework.

WebDriver does not directly interact with browser. Then how does WebDriver communicates with browser? It follows simple client server way of interaction. A proxy driver server sits between the client automation script in Java,Python, C# etc and browser. It is specific to the browser, such as ChromeDriver for Google’s Chrome, GeckoDriver for Mozilla’s Firefox, etc.

To run WebDriver script on chrome browser, we need to first start the ChromeDriver server by instantiating particular driver class.

using (IWebDriver driver= new ChromeDriver())

{ }

Then driver server launches the Chrome browser and starts listening on a particular port Listening on the port refers to accepting HTTP request which can be GET,POST etc.

For every selenium command, WebDriver creates a HTTP request and sends the request to the proxy driver server. All steps to be executed on browser are interpreted and executed by proxy driver server. It receives and sends back response from browser to client automation scripts.

For Ex : driver.Navigate().GoToUrl(““);

Above command opens up specified Url in browser.

WebDriver uses JSON wire protocol for communicating between client and proxy driver server.

Test execution is facilitated by testing frameworks like NUnit, JUnit, MSTest etc. Testing framework provide features like test annotations, assertions which makes test automation easier.

For Ex : In NUnit, [Test] annotation marks method in test class to be executed as test

In NUnit, Assert class provides many methods to compare and verify test outputs

For Ex : Assert.AreEqual(link.Displayed, true);

Below is sample code assembled together to help you say Hello to Selenium 🙂

using System;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace SampleTest
public class HelloSelenium

private const string HomeUrl = “”;

public void LoadApp()
using (IWebDriver driver = new ChromeDriver())

Thread.Sleep(3000); driver.quit()’




Hope this post will help you to get started with Selenium webdriver Next time , we will explore some interesting scripts in selenium test automation

Till then, keep testing Keep sharing

Leave a Reply