1. Introduction to Selenium WebDriver



Selenium WebDriver alias Selenium 2  is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website.

Selenium WebDriver is the latest and most popular flavor of Selenium which allows the test developers to write tests using their favorite language to test on different browsers.

Pre-requisites for Selenium WebDriver:


What is Selenium WebDriver ?
  • Selenium WebDriver allows you to write Automation tests in any supported programming language (say Java). 
  • Selenium WebDriver is also known as Selenium 2.
  • Selenium WebDriver is an open source and free tool.
  • Selenium WebDriver is the main Selenium Project currently (i.e. Selenium RC or  Selenium 1 was the main project earlier). But Selenium 2 still runs Selenium 1's Selenium RC interface for backwards compatibility.
  • Selenium 2 can run Selenium RC command and the concept is known as Backed Selenium.
  • Selenium WebDriver has support for almost all browsers
  • Selenium WebDriver has support for several programming languages like Java, C#, Ruby, Python, Pearl, Javascript and PHP)


How Selenium WebDriver works ?

In order to know how Selenium Web Driver works:

  • First you have to understand how the Selenium RC works by going through the Selenium RC Post # 1
  • Next find out what is the difference between Selenium RC and Selenium WebDriver by going through the below content.

Difference between Selenium WebDriver and Selenium RC:

In Selenium RC we have to use Selenium RC Server as mediator between the Automation Code and the Browser. Generally Browsers wont allow any external code to get executed on any Website they are holding. Since our Selenium Automation code is treated as external code by the Browsers, we required a kind of mediator who can communicate with the browsers, so that the browser can allow the execution of Selenium Automation code on the website they are holding. Hence Selenium RC Server acts as a proxy to allow the Selenium  Automation Code to get executed on the Application Under Test in Browsers. So in Selenium RC we have to make Selenium command calls to the browsers via Selenium RC Server.

But in Selenium WebDriver, we don't require any Server which acts as a mediator. We can make direct Selenium command calls to the browsers.This is possible because of the Browser drivers used in the Selenium Automation code. There is a separate driver for each browser. Suppose if we want to run our Selenium Automation code on Internet Explorer browser, we have to the use the Internet Explorer 
WebDriver. Here WebDriver of browser will communicate with the browser. We use WebDriver API (Application Programming Interface) code in the our Selenium Automation Code and hence our Final Automation Tests containing the WebDriver API code can directly communicate with the browsers.

If your browser and automation tests will all run on the same machine, then your tests only use the WebDriver API, you do not need to run the Selenium-Server ( i.e. WebDriver will run the browser directly).

Are there any cases where you have to use Selenium-Server with Selenium-WebDriver ?

Yes. As we have to use Selenium-Grid concept for distributing our tests over multiple machines and run. In order to run the browser on a remote machine, we have to use Selenium-Server  for communicating with the browsers on remote machines and running the tests on remote machines.



Please comment below to feedback or ask questions.

How to install Selenium WebDriver ? will be explained in the next post.









Followers

Labels