Selenium WebDriver
RSSS

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

14 thoughts on “Selenium WebDriver

  1. satish
    December 27, 2012 at 2:45 pm

    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

    1. December 27, 2012 at 3:38 pm

      Hi Satish,
      I wish I could help, am tightly packed with other stuffs let’s see whether I can help.

      Email me at manojk@assertselenium.com

    2. subramanyam
      November 7, 2014 at 4:30 am

      Hi friends,
      i’m working in share point applications testing selenium is supporting for automate share point applications. If no please suggest me which one is best for automate share point applications.

  2. February 24, 2013 at 10:24 am

    Hi Manoj,

    Do you know if Flash applications can be automated Using Selenium Web Driver?
    If yes can you guide how?

    Regards,
    Krishnan

    1. Manbrinder
      March 31, 2013 at 10:53 pm

      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. November 1, 2013 at 2:27 pm

      Hi there,
      they can be automated, however, not directly by Selenium. I use Java’s Robot functions to do this, but telling the mouse where and how to click to drive the site to perform the actions required.
      You can use web driver and build up a set of Actions, just as you would with a Robot. There are different options out there, you just have to find that is suited to your work style and skill set. Good luck!

      Marcus

  3. Pooja
    April 15, 2013 at 2:19 pm

    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 ?

    1. April 16, 2013 at 12:32 am

      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

  4. Gaurav Arora
    May 25, 2013 at 8:35 am

    Hey guys,
    Can we automate the Silverlight pages with selenium webdriver?
    If yes? Please suggest me any help.
    I’m creating test cases in JUnit and using eclipse.
    thanks and regards,
    Gaurav

  5. nazeer
    July 21, 2013 at 2:31 pm

    hi
    can you share any script to capture the ajax values like in google when we type any value we get list of values without clicking the button.
    please help me
    my mail id is: basha.nazeer83@gmail.com

  6. nagarjuna
    October 22, 2013 at 6:07 pm

    can plz send me code for
    button is avialable in the page.
    how to know the checkbox is check /uncheck.

  7. December 11, 2013 at 6:30 pm

    Hi,

    Anyone can tell me how to handle popup in webdriver.
    I have used driver.switchTo().alert(); method
    It is automatically closing the popup.Here I did not used alert.accept() method.
    Is this expected one and As a tester what are all the test steps to be taken care while validating alert popups.

    Thanks and Regards,
    Priya

    1. sydeesh
      December 16, 2013 at 2:12 pm

      Hi Priya,

      First you have to store the parent window then use the commands where the popup comes ,once all the operations are completed ,you have to switch back to parentwindow.Here you go some sample code for popup window.

      driver=new FirefoxDriver();
      driver.manage().window().maximize();
      driver.get(“http://dev.cropin.in”);
      Thread.sleep(5000);
      String parentwidow=driver.getWindowHandle();
      driver.findElement(By.id(“txtUserName”)).sendKeys(“dfs”);
      driver.findElement(By.id(“txtPassword”)).sendKeys(“dfsf”);
      driver.findElement(By.id(“btnSignIn”)).click();
      driver.switchTo().alert().accept();
      Thread.sleep(5000);
      driver.switchTo().window(parentwidow);
      driver.findElement(By.id(“txtUserName”)).sendKeys(“safsd”);
      driver.findElement(By.id(“txtPassword”)).sendKeys(“dfssfsff”);
      driver.findElement(By.id(“btnSignIn”)).click();
      driver.switchTo().alert().accept();

      Thanks & Regards,
      sydeeh

  8. SURENDRA
    July 1, 2014 at 7:08 am

    Exception in thread “main” org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054 within 45000 ms
    System info: os.name: ‘Windows 7′, os.arch: ‘amd64′, os.version: ’6.1′, java.version: ’1.7.0_03′
    Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.internal.SocketLock.lock(SocketLock.java:92)
    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:71)
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:142)
    at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:86)
    at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:121)
    at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:77)
    at com.cgi.advantage.TestCase1.login(TestCase1.java:41)
    at com.cgi.advantage.TestCase1.main(TestCase1.java:24)

    Getting above error message while trying to run Firefox WebDriver .Pls help.

Leave a Reply

Your email address will not be published. Required fields are marked *