Selenium WebDriver

WebDriver is a tool for automating web application testing, and in particular to verify that functionalities work as expected. It aims to provide a friendly API that’s easy to explore and understand, easier to use than the Selenium-RC (1.0) API, which will help to make your tests easier to read and maintain.

Let us first get clarified about the difference types of selenium that is/was available in the past and the present.

Selenium Core is the heart of the original Selenium implementation, and is a set of JavaScript scripts that control the browser. This is sometimes referred to as “Selenium” and sometimes as “Core”.
Selenium RC was the name given to the language bindings for Selenium Core, and is commonly, referred to as just “Selenium” or “RC”. This actually came up with two components. Selenium server and the client libraries.

.Selenium WebDriver fits in the same role as RC did, and has incorporated the original 1.x bindings. It refers to both the language bindings and the implementations of the individual browser controlling code. This is commonly referred to as just “WebDriver” or sometimes as Selenium 2.

Selenium1.0+WebDriver=Selenium 2.0

SELENIUM WEBDRIVER WORKING

    WebDriver is designed in a simpler and more concise programming interface along with addressing some limitations in the Selenium-RC API.
    WebDriver is a compact Object Oriented API when compared to Selenium1.0
    WebDriver works at the OS/browser level:
    For instance, command type works at the OS level rather than changing the value of the input elements with JavaScript
    It drives the browser much more effectively and over comes the limitations of Selenium 1.x which affected our functional test coverage, like the file upload or download, pop-ups and dialogs barrier or self-signed certificates problems

Selenium RC, It ‘injects’ JavaScript functions into the browser when the browser was loaded and then used its JavaScript to drive the AUT within the browser. WebDriver does not use this technique. Again, it drives the browser directly using the browser’s built in support for automation.

WebDriver drives the tests natively with the browser and emulates the Human interaction with website. Implementation differs on each browser’s.

The merge of the projects combines the strengths of both frameworks: Selenium 2.0 will provide both Selenium 1.x and WebDriver APIs.

This document concentrates more on WebDriver implementation using the WebDriver Java API.
WebDriver is the name of the key interface against which tests should be written, but there are 11 implementing classes, listed as below:

    AndroidDriver,
    AndroidWebDriver,
    ChromeDriver,
    EventFiringWebDriver,
    FirefoxDriver,
    HtmlUnitDriver,
    InternetExplorerDriver,
    IPhoneDriver,
    IPhoneSimulatorDriver,
    RemoteWebDriver,
    SafariDriver

6 thoughts on “Selenium WebDriver

  1. Hi Manoj,

    can you please help me to write code for
    1. video capture using webdriver ,like capture the elements in video ,pause,play stop ,volume.
    Drag the buffered bar and leave it in specific locatoin and capture the screen .

    2.capturing image in webpage and get the dimensions of the image.

    Thanks in Advance,
    Satish

    • hi all,

      I think i am not late to answer this one!

      We can automate flash application, for that we can use javascript or sikuli to automate the video players.

      Thanks,

  2. Hi Manoj, thanks for sharing it.
    Btw , as you have mentioned
    “WebDriver works at the OS/browser level:
    For instance, command type works at the OS level rather than changing the value of the input elements with JavaScript
    It drives the browser much more effectively and over comes the limitations of Selenium 1.x which affected our functional test coverage, like the file upload or download, pop-ups and dialogs barrier or self-signed certificates problems”
    So how can I automate a dialogue box opened on clicking of “download excel file” , also how do I switch in between options “open/ save” & “save/cancle” using sleenium webDriver ?

    • Hi Pooja,
      I guess, you got that little differently. WebDriver works more native and just like how the human Interaction is done. It doesn’t have anything to do with the dialog box.
      Downloading excel file is a complex operation which cannot be simpy automated using the type-SendKeys command.

      I would suggest you to take a look at the below url, on donwloading
      ardesco.lazerycode.com/index.php/2012/07/how-to-download-files-with-selenium-and-why-you-shouldnt/

      Regards,
      Manoj

Leave a Comment