What is selenium WebDriver?

WebDriver in selenium is an Interface and it is designed to overcome some limitations of selenium RC. Selenium WebDriver is also known as Selenium 2.

Selenium 2 supports most of all browsers to run your test cases and many programming languages like C#, Java, Python, Ruby, .Net, Perl, PHP, etc.. to create and modify your test scripts.

You first need to launch a separate application called Selenium Remote Control (RC) Server before you can start testing

  • Selenium RC Server "injects" a Javascript program called Selenium Core into the browser.

  • Once injected, Selenium Core will start receiving instructions from the RC Server from your test program.

  • When the instructions are received, Selenium Core will execute them as Javascript commands.

  • The browser will execute the instructions of Selenium Core, and will relay its response to the RC Server.

  • RC Server will fetch the next instruction from your test script to repeat the whole cycle.

  • Selenium WebDriver does not require selenium server for running test.

  • It controls the browser from the OS level

  • All you need are your programming language's IDE (which contains your Selenium commands-e.g. Eclipse) and a browser.

Advantages:

Speed WebDriver is faster than Selenium RC since it interacts directly to the browser WebDriver is faster than Selenium RC since it interacts directly to the browser

Browser Support

WebDriver can support the headless HtmlUnit browser.HtmlUnit is termed as "headless" because it is an invisible browser - it is GUI-less.It is a very fast browser because no time is spent in waiting for page elements to load.

API

WebDriver's API is simpler than Selenium RC's. It does not contain redundant and confusing commands like RC. ** RC contain redundant and confusing commands like type or typeKeys, click, mouseDown, or mouseDownAt etc

Disadvantages:

It cannot readily support new browsers, but Selenium RC can.

It does not have a built-in command for automatic generation of test results

WebDriver Configuration

Step 1: Download and install Java in your system

Step 2: Download and install Eclipse

Step 3: Download WebDriver Jar Files. (http://www.seleniumhq.org/)

Step 4: Start Eclipse and configure it with selenium WebDriver

  • Select Workspace on eclipse start up

  • File > New > Project > Java Project

  • Create new package> Create New Class

  • > Add external jar files

  • Right click on project > Select Properties > Select Java build path > Navigate to Libraries tab Click on add external JARs button > Browse the Jar Files to add.

Example:

http://www.popuptest.com/popuptest1.html

Last updated