selenium day1

Upload: nitin-tyagi

Post on 06-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 Selenium Day1

    1/4

    WORKING WITH SELENIUM

    SELENIUM

    Selenium is the tool for functional and regression testing

    Having 3 Parts Selenium IDE

    Its a java script framework.

    It is installed as addon on mozilla

    It is used to record user steps on application.

    Selenium RCIt is mainly used to run test suites on multiple browser.

    Selenium GRID+ multiple systems.

    Commands used in selenium are called Selenese

    First, we will describe how the components of Selenium RC operate and the role each plays in

    running your test scripts.

    RC Components

    Selenium RC components are:

    The Selenium Server

    launches and kills browsers interprets and runs the Selenese commands passed from the test program

    acts as anHTTP proxy, intercepting and verifying HTTP messages passed between

    the browser and the AUT.

    Return result of selenium command back to test program.

    Selenium server is bundled with selenium core, automatically inject this selenium

    core to browser when start browser.

    Selenium-Core is a JavaScript program, actually a set of JavaScript functions which interprets and

    executes Selenese commands using the browsers built-in JavaScript interpreter.

    Client libraries which provide the interface between each programming language and theSelenium RC Server.

    * Client libraries provide support of different language to selenium

  • 8/2/2019 Selenium Day1

    2/4

    Here is a simplified architecture diagram....

    The diagram shows the client libraries communicate with the Server passing each Seleniumcommand for execution. Then the server passes the Selenium command to the browser usingSelenium-Core JavaScript commands. The browser, using its JavaScript interpreter, executesthe Selenium command. This runs the Selenese action or verification you specified in your test

    script.

    HOW TO CREATE A BAT FILE TO START SELENIUM SERVER

    1-> Open a Notepad2-> Enter following commands

    ECHO "HELLO WORLD" // To display something on consolePAUSE // Hold Execution until user press Enter

  • 8/2/2019 Selenium Day1

    3/4

    cd D:\

    PAUSE

    Cd Program Files\Java\jdk1.6.0\bin\Selenium\PAUSE

    Java -jar Selenium-server.jar

    3-> Save File as Name.bat file

    What is Web Driver

    New Enhancement to Selenium 2.0.

    We need not to start selenium Server

    Interact with Browser Directly(Not using Java Core etc)

    Support HTML Dom as well, so we can work on multiple elements together.

    HtmlUnitDriver:- is much faster because it run test case in memory not in physical.

    We have Native Drivers for each Browser sp we need to make implements separately for each

    driver.

    Advantage : Fast

    No need to use selenium server.

    Disadvantage : Need to implement native driver for each browser

    Give support to only few browsers till now.

    HOW TO WORK WITH SELENIUM GRID

    Selenium Grid is the part of selenium test suite, which is used to distribute selenium test cases on

    multiple browser and multiple machine with the help of that we can run multiple test cases inparallel.

    Selenium Grid has 2 controls selenium Hub and Selenium RC, selenium hub takes request fromdifferent tests(as RC do in normal condition) and then allocate remote control that are registered to

    the hub.(1 RC to 1 test request)

  • 8/2/2019 Selenium Day1

    4/4