Selenium 2.x / Web Driver

             By
        Aparna Naik
    www.DestinationQA.com




                                1
        www.destinationqa.com
Agenda
What is WebDriver
WebDriver Interface and Implementations
Firefox Driver
Internet Explorer Driver
HTML Unit Driver
Other Drivers

                                          2
                 www.destinationqa.com
Web Driver

Is a Self Contained Library
• No Proxy Server like RC
• Acts just as any normal library

Has Extensive API
• Easy to maintain
• Robust scripting support

                                      3
              www.destinationqa.com
Web Driver Interface
  Selenium JavaDoc

  Base class for different browsers

  The main interface to use for testing

  Represents an idealised web browser

  Methods of WebDriver
  • Control of the browser itself
  • Selection of WebElements
  • Debugging aids



                                                    4
                            www.destinationqa.com
Web Driver



 WebDriver Interface

          Internet   HTML
Firefox                         Opera       Chrome    iPhone    Android
          Explorer    Unit
driver                          Driver       Driver    Driver    Driver
           Driver    driver




                                                                          5
                         www.destinationqa.com
Firefox Driver
Controls the Firefox browser using a
Firefox plugin

Uses a stripped down profile from
what is installed on the machine to
only include the Selenium
WebDriver.xpi (plugin).
By default, the Firefox driver creates
an anonymous profile
                                         6
               www.destinationqa.com
Firefox Driver
Usage
           WebDriver driver = new
           FirefoxDriver();

OS         Windows
           Mac
           Linux      .


Versions   3.0, 3.6

           5, 6

           7, 8


                                                  7
                          www.destinationqa.com
Firefox Driver



    - Runs in a real - Slower than the
    browser and       HtmlUnit Driver
    supports
    JavaScript
    - Faster than the
    Internet Explorer
    Driver

                                         8
              www.destinationqa.com
Internet Explorer Driver
Structure   This driver is controlled by a .dll and is
            thus only available on Windows OS.

Usage
            WebDriver driver = new
            InternetExplorerDriver();
OS
            Windows

Versions    IE 6, IE 7 and IE 8 on XP
            IE 9 on Windows7.
                                                         9
                    www.destinationqa.com
Internet Explorer Driver


                     Comparatively slow
   Runs in a real XPath is not natively
   browser and       supported in most versions.
   supports
   JavaScript with Sizzle is injected - Slower
   all the quirks    than other browsers and
   your end users CSS selectors.
   see.              CSS not natively supported
                     in IE 6 and 7. Sizzle is
                     injected instead.
                     CSS natively supported in
                     IE 8, 9, but doesn’t fully
                  www.destinationqa.com            10
HtmlUnit Driver
Structure   The fastest and most lightweight of
            Drivers. Based on HtmlUnit.
            HtmlUnit is a java based
            implementation of a WebBrowser
            without a GUI.
Usage
            WebDriver driver = new
            HtmlUnitDriver();

OS          Any

Versions    N/A

                                                  11
                  www.destinationqa.com
HtmlUnit Driver



    Fastest                    Emulates other
    implementation of          browsers’
    WebDriver                  JavaScript
    A pure Java solution       behaviour
    and so it is platform
    independent.
    Supports JavaScript


                                                12
                 www.destinationqa.com
Java Script in HtmlUnit
 HtmlUnit’s Java Script engine
 (Rhino) is not used by other popular
 browsers

 What does this mean?
  If web application is tested enabling
  JS engine of HTMLUnit, the results
  may be different as compare to
  other browsers.
                                           13
               www.destinationqa.com
Other Drivers

    Chrome Driver

    Opera Driver

    iPhone Driver

    Android Driver


                                    14
            www.destinationqa.com
Thank You…
Aparna Naik
Email: naik.aparna@destinationqa.com
Tel: +91 99233 50980




                                               15
                       www.destinationqa.com

Selenium drivers

  • 1.
    Selenium 2.x /Web Driver By Aparna Naik www.DestinationQA.com 1 www.destinationqa.com
  • 2.
    Agenda What is WebDriver WebDriverInterface and Implementations Firefox Driver Internet Explorer Driver HTML Unit Driver Other Drivers 2 www.destinationqa.com
  • 3.
    Web Driver Is aSelf Contained Library • No Proxy Server like RC • Acts just as any normal library Has Extensive API • Easy to maintain • Robust scripting support 3 www.destinationqa.com
  • 4.
    Web Driver Interface Selenium JavaDoc Base class for different browsers The main interface to use for testing Represents an idealised web browser Methods of WebDriver • Control of the browser itself • Selection of WebElements • Debugging aids 4 www.destinationqa.com
  • 5.
    Web Driver WebDriverInterface Internet HTML Firefox Opera Chrome iPhone Android Explorer Unit driver Driver Driver Driver Driver Driver driver 5 www.destinationqa.com
  • 6.
    Firefox Driver Controls theFirefox browser using a Firefox plugin Uses a stripped down profile from what is installed on the machine to only include the Selenium WebDriver.xpi (plugin). By default, the Firefox driver creates an anonymous profile 6 www.destinationqa.com
  • 7.
    Firefox Driver Usage WebDriver driver = new FirefoxDriver(); OS Windows Mac Linux . Versions 3.0, 3.6 5, 6 7, 8 7 www.destinationqa.com
  • 8.
    Firefox Driver - Runs in a real - Slower than the browser and HtmlUnit Driver supports JavaScript - Faster than the Internet Explorer Driver 8 www.destinationqa.com
  • 9.
    Internet Explorer Driver Structure This driver is controlled by a .dll and is thus only available on Windows OS. Usage WebDriver driver = new InternetExplorerDriver(); OS Windows Versions IE 6, IE 7 and IE 8 on XP IE 9 on Windows7. 9 www.destinationqa.com
  • 10.
    Internet Explorer Driver Comparatively slow Runs in a real XPath is not natively browser and supported in most versions. supports JavaScript with Sizzle is injected - Slower all the quirks than other browsers and your end users CSS selectors. see. CSS not natively supported in IE 6 and 7. Sizzle is injected instead. CSS natively supported in IE 8, 9, but doesn’t fully www.destinationqa.com 10
  • 11.
    HtmlUnit Driver Structure The fastest and most lightweight of Drivers. Based on HtmlUnit. HtmlUnit is a java based implementation of a WebBrowser without a GUI. Usage WebDriver driver = new HtmlUnitDriver(); OS Any Versions N/A 11 www.destinationqa.com
  • 12.
    HtmlUnit Driver Fastest Emulates other implementation of browsers’ WebDriver JavaScript A pure Java solution behaviour and so it is platform independent. Supports JavaScript 12 www.destinationqa.com
  • 13.
    Java Script inHtmlUnit  HtmlUnit’s Java Script engine (Rhino) is not used by other popular browsers  What does this mean?  If web application is tested enabling JS engine of HTMLUnit, the results may be different as compare to other browsers. 13 www.destinationqa.com
  • 14.
    Other Drivers Chrome Driver Opera Driver iPhone Driver Android Driver 14 www.destinationqa.com
  • 15.
    Thank You… Aparna Naik Email:naik.aparna@destinationqa.com Tel: +91 99233 50980 15 www.destinationqa.com