SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
SELENIUM TOOLS

Introduction to selenium tools(Selenium IDE, Core, RC)

       Selenium is an open source tool for web application testing. Selenium
tests run directly in a browser, just like real users do. It runs in Internet Explorer,
Mozilla Firefox on Windows, Linux, and Macintosh, Safari on the Mac.

      There are three variants of Selenium, which can be used in isolation or in
combination to create complete automation suite for your web applications.

   •   Selenium IDE :

       Selenium IDE is an integrated development environment for Selenium
   tests. It is implemented as a Firefox extension, and allows you to record, edit,
   debug and execute tests. It can also record user actions in most of the
   popular languages like Java, C#, Perl, Ruby etc. This eliminates the need of
   learning new vendor scripting language. For executing scripts created in
   these languages, you will need to use Selenium Remote Control. If you do not
   want to use Remote Control than you will need to create your test script in
   HTML format.

       Biggest drawback of Selenium IDE is its limitation in terms of browser
   support. Though Selenium scripts can be used for most of the browser and
   operating system, Scripts written using Selenium IDE can be used for only
   Firefox browser if it is not used with Selenium RC or Selenium Core.

   •   Selenium Core :

       Selenium Core is a test tool for web applications. Selenium Core tests run
   directly in a browser. And they run in Internet Explorer, Mozilla Firefox on
   Windows, Linux, and Macintosh. But to use Selenium Core we need to make
   it available from the same web server as the application you want to
   test(AUT).

   •   Selenium Remote Control :

      Selenium Remote Control (RC) is a test tool that allows you to write
   automated web application UI tests in any programming language against any
   HTTP website using any mainstream JavaScript-enabled browser.

       Selenium RC comes in two parts.

       1. A server which can automatically launch and kill supported browsers,
           and acts as a HTTP proxy for web requests from those browsers.
       2. Client libraries for your favorite computer language.
Selenium IDE:

  Installation process for Selenium IDE

     Open the download link using Mozilla(version: 1.5 or higher) and choose
  any version of Selenium IDE and select INSTALL NOW. It will get installed
  automatically. The download link is given below.

     Download Link: http://selenium-ide.openqa.org/download.jsp



  Working :
Once the installation is successfully completed, go to ‘Tools’ in the firefox
window. You can find Selenium IDE. Click on Selenium IDE. The small red
button on the right hand side gives you an indication on whether Selenium is
in recording mode or not. Click the red button to start recording and click the
red button again to stop the recording.

    Run will execute the tests with the maximum possible speed. Walk will
execute them with relatively slow speed. In Step mode you will need to tell
Selenium to take small steps. Green tilted triangular button is to execute the
test. Yellow button to pause while executing the test. Blue button helps to
place checkpoints and the final green button is the Selenium Test Runner.

    Test Runner gives you nice browser interface to execute your tests and
also gives summary of how many tests were executed, how many passed
and failed. It also gives similar information on commands which were passed
or failed. Test Runner is available to tests developed in HTML only.

   In selenium, there is option to start a new test, save test and open the
saved test. It is also possible to export scripts. We have other self explanatory
options like encoding of test files, timeout under the Options tab. When we
access the Format tab under Options tab, we have an option as to specify
what kind of formatting we would like in the generated code as Selenium IDE
can generate code in variety of languages.

Recording and Executing a Test:

   •   Make sure you have installed Selenium IDE in Firefox.
   •   Open Firefox and application you want to test
   •   Launch Selenium IDE using tools-Selenium IDE
   •   By default, you should be in the recording mode, but confirm it by
       observing the Red button.
   •   By default it will be in the HTML format. Otherwise, go to Options-
       Format-Select HTML Format.
   •   Record some actions and make sure that these are coming on
       Selenium IDE.
   •   During recording if you right click on any element it will show all the
       selenium commands available.
   •   You can also edit existing command, by selecting it and editing on the
       boxes available.
   •   You can also insert/delete commands by choosing appropriate option
       after right clicking.
   •   Choose appropriate run option - i.e walk, run or test runner and review
       your results.
Video presentation to record and execute a test :

   http://wiki.openqa.org/download/attachments/400/Selenium+IDE.swf?

Converting the recorded script into different Languages :

   •   Open Firefox and application you want to test.
   •   Record operations on the web application which you want to test
   •   Insert check points
   •   Go to Options menu – Format – Select any language
Advantages:

  •   It is a Freeware
  •   Simple, Easy to install, Easy to work
  •   Selenium IDE is the only flavor of Selenium which allows you to record
      user action on browser window
  •   Can also record user actions in most of the popular languages like
      Java, C#, Perl, Ruby
  •   It will not record any operation that you do on your computer apart from
      the events on Firefox browser window
  •   During recording if you right click on any element it will show all the
      selenium commands available
  •   You can also edit existing command, by selecting it and editing on the
      boxes available
•   You can also insert/delete commands by choosing appropriate option
           after right clicking
       •   Choose appropriate run option - i.e walk, run or test runner and review
           your results

   Disadvantages:

       •   Limitation in terms of browser support (It runs only in Mozilla)
       •   We can’t run recorded script if it is converted to Java, C#, Ruby etc.
       •   Not allowed to write manual scripts like conditions and Loops for Data
           Driven Testing
       •   There is no option to verify images.




Selenium RC:

   Installing process for Selenium RC :

       The Selenium Server is written in Java, and requires the Java Runtime
Environment (JRE) version 1.5.0 or higher in order to start. You may already
have it installed. Try running this from the command line:

       java -version

        You should see a brief message telling you what version of Java is
installed, like this:

        java version "1.5.0_07"
       Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-
b03)
       Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode)

        If you see an error message instead, you may need to install the JRE, or
you may need to add it to your PATH environment variable if it is already
installed.

        Open the link mentioned below and download Selenium RC. Extract it,
you will get Selenium Server folder and Java, Ruby, Perl, Dot Net, PHP, Python
Client folders also. Make sure that whether ‘selenium-server.jar’ file exist in the
server folder or not. Open Command window and type the command to start the
server.
Java -jar selenium-server.jar                     (non-interactive mode)

      Java -jar selenium-server.jar -interactive         (interactive mode)

      Interactive mode: In this mode user ca execute commands individually.
   For example, to open google.com in the firefox, the command to be typed is

      cmd=getNewBrowserSession&1=*firefox&2=http://www.google.com

      Non-Interactive mode: In this mode server will be ready to take and
process HTTP web requests when user running the selenium scripts.

      Download ink : http://selenium-rc.openqa.org/download.html

   Starting Java Client :

      •   Download Junit software
      •   Add the path of junit-4.0.jar file to CLASSPATH
      •   Add path of selenium-java-client-driver.jar to CALSSPATH
      •   Write the Selenium Script in Java using any java editor
      •   Compile and execute it

   Note: Start the Selenium Server before executing the script.

   Example Selenium Script using Java:

import com.thoughtworks.selenium.*;
import junit.framework.*;
import java.util.regex.Pattern;

public class PBNLoginTest extends SeleneseTestCase
{

      private Selenium selenium;

       public void setUp()
       {
              String BaseURL = "http://192.168.1.132/pbn/";
              selenium = new DefaultSelenium("SELENIUM_SERVER_IP", 4444,
"*iexplore", BaseURL);
              selenium.start();
       }
       public void tearDown()
       {
              selenium.stop();
       }
public static void main(String[] args)
       {
              PBNLoginTest e = new PBNLoginTest();
              e.setUp();
              e.PBNLogin();
              e.tearDown();
       }


       public void PBNLogin()
       {
              int Total_Check_Points = 1;
              int Passed = 0, Failed = 0;

              selenium.open("/pbn/Default.aspx");
              //Checking Login using valid LoginID and valid password
              selenium.type("txtLogin", "Rajasekhar.Chintha");
              String Login = selenium.getValue("txtLogin");
              selenium.type("txtPassword", "abcd1234");
              selenium.click("link=GO");
              selenium.waitForPageToLoad("30000");
              selenium.selectFrame("link");

              boolean Login_Name = selenium.isTextPresent("User*"+Login+"*");

               if (!Login_Name)
               {
                       System.out.println("Failed : Text 'User : " + Login + "(Test
Analyst)' is not found");
                       Failed++;
               }
               else
               {
                       System.out.println("Passed : Text 'User : " + Login + "(Test
Analyst)' is found");
                       Passed++;
               }

              selenium.click("link=Logout");

              System.out.println("Total Check Points : " + Total_Check_Points + "
Passed : " + Passed + " Failed : " + Failed);

       }
}




   Note: To compile and execute the script, use the following commands

       Javac scriptname.java                       (To compile the script)

       Java scriptname                             (To execute the script)

   Features :

       •   We can use Java syntax to write test script
       •   Easy to conduct Data Driven Testing
       •   We can read files to get test data
       •   We can store Test Results into files



   Disadvantages :

       •   There are no Results File generated by Selenium RC. We have to
           store results in files or etc using Java.



   Launching Browsers:

      To launch browsers, use *firefox, *chrome, *iexplore, *iehta in the
DefaultSelenium command.

       •   *firefox and *iexplore are used to launch FireFox and Internet
           Explorer for HTTP web pages respectively.
       •   *chrome and *iehta are used to launch FireFox and Internet Explorer
           for HTTPS web pages respectively.

   Some Important Server Commands:

   Usage: java -jar selenium-server.jar [-interactive] [options]

       •   -port <nnnn>: The port number the selenium server should use
           (default 4444)
       •   -timeout <nnnn>: An integer number of seconds before we should
           give up
•    -interactive: Puts you into interactive mode.
       •    -multiWindow: Puts you into a mode where the test web site executes
            in a separate window, and selenium supports frames
       •    -forcedBrowserMode <browser>: Sets the browser mode (e.g.
            "*iexplore" for all sessions, no matter what is passed to
            getNewBrowserSession)
       •    -htmlSuite <browser> <startURL> <suiteFile> <resultFile>: Run a
            single HTML Selenese (Selenium Core) suite and then exit
            immediately, using the specified browser on the specified URL. You
            need to specify the absolute path to the HTML test suite as well as the
            path to the HTML results file we'll generate




   Element Locators:

      Element Locators tell Selenium which HTML element a command refers to. The
   format of a locator is:

       locatorType=argument

           A locator type can be an element id, an element name, an xpath expression,
   link text, and more.

       Examples:-

           selenium.click(“id=idOfThing”);                            (an id locator)
           selenium.click(“name=nameOfThing”);                       (a name locator)
           selenium.click(“xpath=//img[@alt='The image alt text']”); (an xpath
locator)
           selenium.click(“dom=document.images[56]” );               (DOM locator)
           selenium.click(“link=Test Page For Selenium”);            (a link locator)
           selenium.click(“css=span#firstChild”);                    (a css locator)



Frequently used Selenium Commands:

 S.No            Command                                    Description
     1 assignId("Locator","String")                   Temporarily sets the "id" attribute
of the specified element
                                            Captures a PNG screenshot to the
 2 captureScreenshot("File name")           specified file.
                                            Check a toggle-button
 3 Check("Locator")                         (checkbox/radio)
                                            Clicks on a link, button, checkbox
 4 click("Locator")                         or radio button.
                                            Clicks on a link, button, checkbox
 5 clickAt("Locator","Coordinate String")   or radio button.
                                            Simulates the user clicking the
                                            "close" button in the title bar of a
 6 close()                                  popup window or tab.
                                            Double clicks on a link, button,
 7 doubleClick("Locator")                   checkbox or radio button.
   doubleClickAt("Locator","Coordinate      Double clicks on a link, button,
 8 String")                                 checkbox or radio button.
                                            Retrieves the message of a
                                            JavaScript alert generated during
                                            the previous action, or fail if there
 9 getAlert()                               were no alerts.
                                            Returns the IDs of all buttons on
10 getAllButtons()                          the page.
                                            Returns the IDs of all input fields
11 getAllFields()                           on the page.
                                            Returns the IDs of all links on the
12 getAllLinks()                            page.
                                            Returns the IDs of all windows
13 getAllWindowIds()                        that the browser knows about.
                                            Returns the names of all windows
14 getAllWindowNames()                      that the browser knows about.
                                            Returns the titles of all windows
15 getAllWindowTitles()                     that the browser knows about.
                                            Gets the value of an element
16 getAttribute("Attribute Locator")        attribute.
17 getBodyText()                            Gets the entire text of the page.
                                            Retrieves the message of a
                                            JavaScript confirmation dialog
                                            generated during the previous
18 getConfirmation()                        action.
                                             Return all cookies of the current
19 getCookie()                              page under test.
20 getElementHeight("Locator")              Retrieves the height of an element
                                            Retrieves the horizontal position of
21 getElementPositionLeft("Locator")        an element
                                            Retrieves the vertical position of
22 getElementPositionTop("Locator")         an element
23 getElementWidth("Locator")             Retrieves the width of an element
                                           Gets the result of evaluating the
24 getEval("JS Expression")               specified JavaScript snippet.
                                          Gets the absolute URL of the
25 getLocation()                          current page.
                                          Returns the number of pixels
                                          between "mousemove" events
                                          during dragAndDrop commands
26 getMouseSpeed()                        (default=10).
                                          Retrieves the message of a
                                          JavaScript question prompt dialog
                                          generated during the previous
27 getPrompt()                            action.
                                          Gets option element ID for
                                          selected option in the specified
28 getSelectedId("Select Locator")        select element.
                                          Gets all option element IDs for
                                          selected options in the specified
29 getSelectedIds("Select Locator")       select or multi-select element.
                                          Gets option index (option number,
                                          starting at 0) for selected option in
30 getSelectedIndex("Select Locator")     the specified select element.
                                          Gets all option indexes (option
                                          number, starting at 0) for selected
                                          options in the specified select or
31 getSelectedIndexes("Select Locator")   multi-select element.
                                          Gets option label (visible text) for
                                          selected option in the specified
32 getSelectedLable("Select Locator")     select element.
                                          Gets all option labels (visible text)
                                          for selected options in the
                                          specified select or multi-select
33 getSelectedLables("Select Locator")    element.
                                          Gets option value (value attribute)
                                          for selected option in the specified
34 getSelectedValue("Select Locator")     select element.
                                          Gets all option values (value
                                          attributes) for selected options in
                                          the specified select or multi-select
35 getSelectedValues("Select Locator")    element.
                                          Gets all option labels in the
36 getSelectOptions("Select Locator")     specified select drop-down.
                                          Get execution speed (i.e., get the
                                          millisecond length of the delay
                                          following each selenium
37 getSpeed()                             operation).
38 getTable("Table Cell Address”)       Gets the text from a cell of a table.
39 getText("Locator")                   Gets the text of an element.
40 getTitle()                           Gets the title of the current page.
                                        Gets the (whitespace-trimmed)
                                        value of an input field (or anything
41 getValue("Locator")                  else with a value parameter).
                                        Determine whether current/locator
   getWhetherThisFrameMatchFrameEx      identify the frame containing this
42 pression("Current Frame","Target")   running code
                                         Determine whether
   getWhetherThisWindowMatchWindow      currentWindow String plus target
   Expression("Current                  identify the window containing
43 Window","Target")                    this running code.
                                        Simulates the user clicking the
44 goBack()                             "back" button on their browser.
                                        Briefly changes the
                                        backgroundColor of the specified
45 highlight("Locator")                 element yellow.
46 isAlertPresent()                     Has an alert occurred?
                                         Gets whether a toggle-button
47 isChecked("Locator")                 (checkbox/radio) is checked.
48 isConfirmationPresent()              Has confirm() been called?
                                        Determines whether the specified
                                        input element is editable, ie hasn't
49 isEditable("Locator")                been disabled.
                                        Verifies that the specified element
50 isElementPresent("Locator")          is somewhere on the page.
51 isPromptPresent()                     Has a prompt occurred?
                                        Determines whether some option
52 isSomethingSelected("Locator")       in a drop-down menu is selected.
                                        Verifies that the specified text
                                        pattern appears somewhere on the
53 isTextPresent("Pattern")             rendered page shown to the user.
                                        Determines if the specified
54 isVisible("Locator")                 element is visible.
55 open("URL")                          Opens an URL in the test frame.
                                        Opens a popup window (if a
                                        window with that ID isn't already
56 openWindow("URL","WindowID")         open).
                                         Simulates the user clicking the
57 refresh()                            "Refresh" button on their browser.
                                        Unselects all of the selected
58 removeAllSelections("Locator")       options in a multi-select element.
                                        Remove a selection from the set of
   removeSelection("Locator","Option    selected options in a multi-select
59 Locator")                            element using an option locator.
select("Select Locator","Option        Select an option from a drop-down
   60 Locator")                              using an option locator.
                                             Selects a frame within the current
   61 selectFrame("Locator")                 window.
                                             Selects a popup window; once a
                                             popup window has been selected,
   62 selectWindow("WindowID")               all commands go to that window.
                                             Set execution speed (i.e., set the
                                             millisecond length of a delay
                                             which will follow each selenium
   63 setSpeed("Value")                      operation).
                                             Specifies the amount of time that
                                             Selenium will wait for actions to
   64 setTimeout("Time")                     complete.
                                              Launches the browser with a new
   65 start()                                Selenium session
                                             Ends the test session, killing the
   66 stop()                                 browser
   67 submit("Form Locator")                 Submit the specified form.
                                              Sets the value of an input field, as
   68 type("Locator","Value")                though you typed it in.
                                              Uncheck a toggle-button
   69 unCheck("Locator")                     (checkbox/radio)
                                             Runs the specified JavaScript
      waitForCondition("JavaScript","Timeo   snippet repeatedly until it
   70 ut")                                   evaluates to "true".
      waitForFrameToLoad("Frame              Waits for a new frame to load.
   71 Address","Timeout")
   72 waitForPageToLoad("Timeout")           Waits for a new page to load.
                                             Waits for a popup window to
   73 waitForPopUp("WindowID","Timeout")     appear and load up.
                                              Gives focus to the currently
   74 windowFocus()                          selected window
                                             Resize currently selected window
   75 windowMaximize()                       to take up the entire screen



Handling Keyboard and Mouse:

 S.No                 Command                          Description
                                              Press the Alt key and hold it down
                                             until AltUp() is called or a new
     1 altKeyDown()                          page is loaded.
     2 altKeyUp()                             Release the Alt key.
     3 controlKeyDown()                       Press the Control key and hold it
down until ControlUp() is called or
                                        a new page is loaded.
 4 controlKeyUp()                        Release the Control key.
                                         Simulates a user pressing a key
 5 keyDown("Locator","Key Sequence")    (without releasing it yet).
 6 keyUp("Locator","Key Sequence")       Simulates a user releasing a key.
                                         Simulates a user pressing and
 7 KeyPress("Locator","Key Sequence")   releasing a key.
                                         Press the meta key and hold it
                                        down until MetaUp() is called or a
 8 metaKeyDown()                        new page is loaded.
 9 metaKeyUp()                           Release the meta key.
                                          Simulates a user pressing the
                                        mouse button (without releasing it
10 mouseDown("Locator")                 yet) on the specified element.
                                         Simulates a user pressing the
   mouseDownAt("Locator","Coordinate    mouse button (without releasing it
11 String")                             yet) at the specified location.
                                         Simulates a user pressing the
                                        mouse button (without releasing it
12 mouseMove("Locator")                 yet) on the specified element.
                                         Simulates a user pressing the
   mouseMoveAt("Locator","Coordinate    mouse button (without releasing it
13 String")                             yet) on the specified element.
                                         Simulates a user moving the
                                        mouse pointer away from the
14 mouseOut("Locator")                  specified element.
                                         Simulates a user hovering a
15 mouseOver("Locator")                 mouse over the specified element.
                                         Simulates the event that occurs
                                        when the user releases the mouse
                                        button (i.e., stops holding the
                                        button down) on the specified
16 mouseUp("Locator")                   element.
                                         Simulates the event that occurs
                                        when the user releases the mouse
                                        button (i.e., stops holding the
   mouseUpAt("Locator","Coordinate      button down) at the specified
17 String")                             location.
                                         Press the shift key and hold it
                                        down until doShiftUp() is called or
18 shiftKeyDown()                       a new page is loaded.
19 shiftKeyUp()                           Release the shift key.
S.No     Object/Property                            Command
1       Text Box             getValue(), getText(), isEditable(), isVisible(), type()
2       List Box             getSelectedId(),getSelectedIndex(), ,
                             getSelectedLabel(),getSelectedValue(),
                             getSelectOptions(), select()
3       Multi Select         getSelectedIds(),getSelectedIndexes(),
        Element              getSelectedLabels(),getSelectedValues(),isSomethin
                             gSelected()
4       Radio Button         check(), click(), isChecked()
5       Check Box            Check(), click(),isChecked(), uncheck()
6       Button               click()
7       Link                 click(), getAllLinks()
8       Text                 getText(),getBodyText()
9       Tables and Cells     getTable()




Consider this feature matrix :

                        Selenium        Selenium        Selenium        Selenium
                          IDE              RC             Core          Core HTA
Browser Support        Firefox Only       Many             All           IE Only

Requires Remote            No              No              Yes              No
Installation
Supports                   Yes            Yes*             Yes             Yes
HTTPS/SSL
Supports Multiple          Yes            Yes*             No              Yes
Domains
Requires Java              No              Yes             No               No


Saves Test                 No**            Yes             No              Yes
Results to Disk
Language                Selenese          Many          Selenese        Selenese
Support                   Only                            Only            Only


•   *= experimental support is available in Selenium RC
•   ** = theoretically possible, but not currently implemented

Contenu connexe

Tendances

Web application testing with Selenium
Web application testing with SeleniumWeb application testing with Selenium
Web application testing with SeleniumKerry Buckley
 
Selenium test automation
Selenium test automationSelenium test automation
Selenium test automationSrikanth Vuriti
 
#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"
#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"
#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"Agile Testing Alliance
 
Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsNick Belhomme
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with seleniumTzirla Rozental
 
Selenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesSelenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesVijay Rangaiah
 
Selenium Installation
Selenium  InstallationSelenium  Installation
Selenium InstallationANKUR-BA
 
Selenium - Installation
Selenium - InstallationSelenium - Installation
Selenium - InstallationRajesh-QA
 

Tendances (19)

Selenium
SeleniumSelenium
Selenium
 
Web application testing with Selenium
Web application testing with SeleniumWeb application testing with Selenium
Web application testing with Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium ide made easy
Selenium ide made easySelenium ide made easy
Selenium ide made easy
 
Selenium test automation
Selenium test automationSelenium test automation
Selenium test automation
 
#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"
#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"
#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance tests
 
QSpiders - Automation using Selenium
QSpiders - Automation using SeleniumQSpiders - Automation using Selenium
QSpiders - Automation using Selenium
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Selenium
SeleniumSelenium
Selenium
 
Selenium IDE features
Selenium IDE featuresSelenium IDE features
Selenium IDE features
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
 
Selenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesSelenium Presentation at Engineering Colleges
Selenium Presentation at Engineering Colleges
 
Selenium with java
Selenium with javaSelenium with java
Selenium with java
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Selenium Installation
Selenium  InstallationSelenium  Installation
Selenium Installation
 
Selenium - Installation
Selenium - InstallationSelenium - Installation
Selenium - Installation
 

Similaire à Selenium IDE: Installation and Recording Basics

Selenium by using JAVA
Selenium by using JAVASelenium by using JAVA
Selenium by using JAVAmahirayavarapu
 
Selenium Basics by Quontra Solutions
Selenium Basics by Quontra SolutionsSelenium Basics by Quontra Solutions
Selenium Basics by Quontra SolutionsQUONTRASOLUTIONS
 
Selenium institute in bangalore
Selenium institute in bangaloreSelenium institute in bangalore
Selenium institute in bangaloreTIB Academy
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using RubyKumari Warsha Goel
 
Learn SELENIUM at ASIT
Learn SELENIUM at ASITLearn SELENIUM at ASIT
Learn SELENIUM at ASITASIT
 
Selenium By Pravin Mishra
Selenium By Pravin MishraSelenium By Pravin Mishra
Selenium By Pravin MishraPravin Mishra
 
Selenium training
Selenium trainingSelenium training
Selenium trainingRobin0590
 
First steps with selenium rc
First steps with selenium rcFirst steps with selenium rc
First steps with selenium rcDang Nguyen
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using seleniumTờ Rang
 
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01Aravindharamanan S
 
Software testing tools (free and open source)
Software testing tools (free and open source)Software testing tools (free and open source)
Software testing tools (free and open source)Wael Mansour
 
Selenium Installation
Selenium InstallationSelenium Installation
Selenium InstallationSachin-QA
 
Tanvir Afzal: Selenium
Tanvir Afzal: SeleniumTanvir Afzal: Selenium
Tanvir Afzal: SeleniumSQABD
 

Similaire à Selenium IDE: Installation and Recording Basics (20)

Selenium by using JAVA
Selenium by using JAVASelenium by using JAVA
Selenium by using JAVA
 
Selenium Basics by Quontra Solutions
Selenium Basics by Quontra SolutionsSelenium Basics by Quontra Solutions
Selenium Basics by Quontra Solutions
 
BCS Selenium Workshop
BCS Selenium WorkshopBCS Selenium Workshop
BCS Selenium Workshop
 
Selenium institute in bangalore
Selenium institute in bangaloreSelenium institute in bangalore
Selenium institute in bangalore
 
Selenium Testing
Selenium Testing Selenium Testing
Selenium Testing
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using Ruby
 
Learn SELENIUM at ASIT
Learn SELENIUM at ASITLearn SELENIUM at ASIT
Learn SELENIUM at ASIT
 
Selenium By Pravin Mishra
Selenium By Pravin MishraSelenium By Pravin Mishra
Selenium By Pravin Mishra
 
Selenium training
Selenium trainingSelenium training
Selenium training
 
Selenium
SeleniumSelenium
Selenium
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
First steps with selenium rc
First steps with selenium rcFirst steps with selenium rc
First steps with selenium rc
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
 
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
 
Software testing tools (free and open source)
Software testing tools (free and open source)Software testing tools (free and open source)
Software testing tools (free and open source)
 
Selenium (1)
Selenium (1)Selenium (1)
Selenium (1)
 
Selenium Introduction
Selenium IntroductionSelenium Introduction
Selenium Introduction
 
Selenium Installation
Selenium InstallationSelenium Installation
Selenium Installation
 
Selenium
SeleniumSelenium
Selenium
 
Tanvir Afzal: Selenium
Tanvir Afzal: SeleniumTanvir Afzal: Selenium
Tanvir Afzal: Selenium
 

Dernier

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Dernier (20)

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 

Selenium IDE: Installation and Recording Basics

  • 1. SELENIUM TOOLS Introduction to selenium tools(Selenium IDE, Core, RC) Selenium is an open source tool for web application testing. Selenium tests run directly in a browser, just like real users do. It runs in Internet Explorer, Mozilla Firefox on Windows, Linux, and Macintosh, Safari on the Mac. There are three variants of Selenium, which can be used in isolation or in combination to create complete automation suite for your web applications. • Selenium IDE : Selenium IDE is an integrated development environment for Selenium tests. It is implemented as a Firefox extension, and allows you to record, edit, debug and execute tests. It can also record user actions in most of the popular languages like Java, C#, Perl, Ruby etc. This eliminates the need of learning new vendor scripting language. For executing scripts created in these languages, you will need to use Selenium Remote Control. If you do not want to use Remote Control than you will need to create your test script in HTML format. Biggest drawback of Selenium IDE is its limitation in terms of browser support. Though Selenium scripts can be used for most of the browser and operating system, Scripts written using Selenium IDE can be used for only Firefox browser if it is not used with Selenium RC or Selenium Core. • Selenium Core : Selenium Core is a test tool for web applications. Selenium Core tests run directly in a browser. And they run in Internet Explorer, Mozilla Firefox on Windows, Linux, and Macintosh. But to use Selenium Core we need to make it available from the same web server as the application you want to test(AUT). • Selenium Remote Control : Selenium Remote Control (RC) is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser. Selenium RC comes in two parts. 1. A server which can automatically launch and kill supported browsers, and acts as a HTTP proxy for web requests from those browsers. 2. Client libraries for your favorite computer language.
  • 2. Selenium IDE: Installation process for Selenium IDE Open the download link using Mozilla(version: 1.5 or higher) and choose any version of Selenium IDE and select INSTALL NOW. It will get installed automatically. The download link is given below. Download Link: http://selenium-ide.openqa.org/download.jsp Working :
  • 3. Once the installation is successfully completed, go to ‘Tools’ in the firefox window. You can find Selenium IDE. Click on Selenium IDE. The small red button on the right hand side gives you an indication on whether Selenium is in recording mode or not. Click the red button to start recording and click the red button again to stop the recording. Run will execute the tests with the maximum possible speed. Walk will execute them with relatively slow speed. In Step mode you will need to tell Selenium to take small steps. Green tilted triangular button is to execute the test. Yellow button to pause while executing the test. Blue button helps to place checkpoints and the final green button is the Selenium Test Runner. Test Runner gives you nice browser interface to execute your tests and also gives summary of how many tests were executed, how many passed and failed. It also gives similar information on commands which were passed or failed. Test Runner is available to tests developed in HTML only. In selenium, there is option to start a new test, save test and open the saved test. It is also possible to export scripts. We have other self explanatory options like encoding of test files, timeout under the Options tab. When we access the Format tab under Options tab, we have an option as to specify what kind of formatting we would like in the generated code as Selenium IDE can generate code in variety of languages. Recording and Executing a Test: • Make sure you have installed Selenium IDE in Firefox. • Open Firefox and application you want to test • Launch Selenium IDE using tools-Selenium IDE • By default, you should be in the recording mode, but confirm it by observing the Red button. • By default it will be in the HTML format. Otherwise, go to Options- Format-Select HTML Format. • Record some actions and make sure that these are coming on Selenium IDE. • During recording if you right click on any element it will show all the selenium commands available. • You can also edit existing command, by selecting it and editing on the boxes available. • You can also insert/delete commands by choosing appropriate option after right clicking. • Choose appropriate run option - i.e walk, run or test runner and review your results.
  • 4. Video presentation to record and execute a test : http://wiki.openqa.org/download/attachments/400/Selenium+IDE.swf? Converting the recorded script into different Languages : • Open Firefox and application you want to test. • Record operations on the web application which you want to test • Insert check points • Go to Options menu – Format – Select any language
  • 5. Advantages: • It is a Freeware • Simple, Easy to install, Easy to work • Selenium IDE is the only flavor of Selenium which allows you to record user action on browser window • Can also record user actions in most of the popular languages like Java, C#, Perl, Ruby • It will not record any operation that you do on your computer apart from the events on Firefox browser window • During recording if you right click on any element it will show all the selenium commands available • You can also edit existing command, by selecting it and editing on the boxes available
  • 6. You can also insert/delete commands by choosing appropriate option after right clicking • Choose appropriate run option - i.e walk, run or test runner and review your results Disadvantages: • Limitation in terms of browser support (It runs only in Mozilla) • We can’t run recorded script if it is converted to Java, C#, Ruby etc. • Not allowed to write manual scripts like conditions and Loops for Data Driven Testing • There is no option to verify images. Selenium RC: Installing process for Selenium RC : The Selenium Server is written in Java, and requires the Java Runtime Environment (JRE) version 1.5.0 or higher in order to start. You may already have it installed. Try running this from the command line: java -version You should see a brief message telling you what version of Java is installed, like this: java version "1.5.0_07" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07- b03) Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode) If you see an error message instead, you may need to install the JRE, or you may need to add it to your PATH environment variable if it is already installed. Open the link mentioned below and download Selenium RC. Extract it, you will get Selenium Server folder and Java, Ruby, Perl, Dot Net, PHP, Python Client folders also. Make sure that whether ‘selenium-server.jar’ file exist in the server folder or not. Open Command window and type the command to start the server.
  • 7. Java -jar selenium-server.jar (non-interactive mode) Java -jar selenium-server.jar -interactive (interactive mode) Interactive mode: In this mode user ca execute commands individually. For example, to open google.com in the firefox, the command to be typed is cmd=getNewBrowserSession&1=*firefox&2=http://www.google.com Non-Interactive mode: In this mode server will be ready to take and process HTTP web requests when user running the selenium scripts. Download ink : http://selenium-rc.openqa.org/download.html Starting Java Client : • Download Junit software • Add the path of junit-4.0.jar file to CLASSPATH • Add path of selenium-java-client-driver.jar to CALSSPATH • Write the Selenium Script in Java using any java editor • Compile and execute it Note: Start the Selenium Server before executing the script. Example Selenium Script using Java: import com.thoughtworks.selenium.*; import junit.framework.*; import java.util.regex.Pattern; public class PBNLoginTest extends SeleneseTestCase { private Selenium selenium; public void setUp() { String BaseURL = "http://192.168.1.132/pbn/"; selenium = new DefaultSelenium("SELENIUM_SERVER_IP", 4444, "*iexplore", BaseURL); selenium.start(); } public void tearDown() { selenium.stop(); }
  • 8. public static void main(String[] args) { PBNLoginTest e = new PBNLoginTest(); e.setUp(); e.PBNLogin(); e.tearDown(); } public void PBNLogin() { int Total_Check_Points = 1; int Passed = 0, Failed = 0; selenium.open("/pbn/Default.aspx"); //Checking Login using valid LoginID and valid password selenium.type("txtLogin", "Rajasekhar.Chintha"); String Login = selenium.getValue("txtLogin"); selenium.type("txtPassword", "abcd1234"); selenium.click("link=GO"); selenium.waitForPageToLoad("30000"); selenium.selectFrame("link"); boolean Login_Name = selenium.isTextPresent("User*"+Login+"*"); if (!Login_Name) { System.out.println("Failed : Text 'User : " + Login + "(Test Analyst)' is not found"); Failed++; } else { System.out.println("Passed : Text 'User : " + Login + "(Test Analyst)' is found"); Passed++; } selenium.click("link=Logout"); System.out.println("Total Check Points : " + Total_Check_Points + " Passed : " + Passed + " Failed : " + Failed); }
  • 9. } Note: To compile and execute the script, use the following commands Javac scriptname.java (To compile the script) Java scriptname (To execute the script) Features : • We can use Java syntax to write test script • Easy to conduct Data Driven Testing • We can read files to get test data • We can store Test Results into files Disadvantages : • There are no Results File generated by Selenium RC. We have to store results in files or etc using Java. Launching Browsers: To launch browsers, use *firefox, *chrome, *iexplore, *iehta in the DefaultSelenium command. • *firefox and *iexplore are used to launch FireFox and Internet Explorer for HTTP web pages respectively. • *chrome and *iehta are used to launch FireFox and Internet Explorer for HTTPS web pages respectively. Some Important Server Commands: Usage: java -jar selenium-server.jar [-interactive] [options] • -port <nnnn>: The port number the selenium server should use (default 4444) • -timeout <nnnn>: An integer number of seconds before we should give up
  • 10. -interactive: Puts you into interactive mode. • -multiWindow: Puts you into a mode where the test web site executes in a separate window, and selenium supports frames • -forcedBrowserMode <browser>: Sets the browser mode (e.g. "*iexplore" for all sessions, no matter what is passed to getNewBrowserSession) • -htmlSuite <browser> <startURL> <suiteFile> <resultFile>: Run a single HTML Selenese (Selenium Core) suite and then exit immediately, using the specified browser on the specified URL. You need to specify the absolute path to the HTML test suite as well as the path to the HTML results file we'll generate Element Locators: Element Locators tell Selenium which HTML element a command refers to. The format of a locator is: locatorType=argument A locator type can be an element id, an element name, an xpath expression, link text, and more. Examples:- selenium.click(“id=idOfThing”); (an id locator) selenium.click(“name=nameOfThing”); (a name locator) selenium.click(“xpath=//img[@alt='The image alt text']”); (an xpath locator) selenium.click(“dom=document.images[56]” ); (DOM locator) selenium.click(“link=Test Page For Selenium”); (a link locator) selenium.click(“css=span#firstChild”); (a css locator) Frequently used Selenium Commands: S.No Command Description 1 assignId("Locator","String") Temporarily sets the "id" attribute
  • 11. of the specified element Captures a PNG screenshot to the 2 captureScreenshot("File name") specified file. Check a toggle-button 3 Check("Locator") (checkbox/radio) Clicks on a link, button, checkbox 4 click("Locator") or radio button. Clicks on a link, button, checkbox 5 clickAt("Locator","Coordinate String") or radio button. Simulates the user clicking the "close" button in the title bar of a 6 close() popup window or tab. Double clicks on a link, button, 7 doubleClick("Locator") checkbox or radio button. doubleClickAt("Locator","Coordinate Double clicks on a link, button, 8 String") checkbox or radio button. Retrieves the message of a JavaScript alert generated during the previous action, or fail if there 9 getAlert() were no alerts. Returns the IDs of all buttons on 10 getAllButtons() the page. Returns the IDs of all input fields 11 getAllFields() on the page. Returns the IDs of all links on the 12 getAllLinks() page. Returns the IDs of all windows 13 getAllWindowIds() that the browser knows about. Returns the names of all windows 14 getAllWindowNames() that the browser knows about. Returns the titles of all windows 15 getAllWindowTitles() that the browser knows about. Gets the value of an element 16 getAttribute("Attribute Locator") attribute. 17 getBodyText() Gets the entire text of the page. Retrieves the message of a JavaScript confirmation dialog generated during the previous 18 getConfirmation() action. Return all cookies of the current 19 getCookie() page under test. 20 getElementHeight("Locator") Retrieves the height of an element Retrieves the horizontal position of 21 getElementPositionLeft("Locator") an element Retrieves the vertical position of 22 getElementPositionTop("Locator") an element
  • 12. 23 getElementWidth("Locator") Retrieves the width of an element Gets the result of evaluating the 24 getEval("JS Expression") specified JavaScript snippet. Gets the absolute URL of the 25 getLocation() current page. Returns the number of pixels between "mousemove" events during dragAndDrop commands 26 getMouseSpeed() (default=10). Retrieves the message of a JavaScript question prompt dialog generated during the previous 27 getPrompt() action. Gets option element ID for selected option in the specified 28 getSelectedId("Select Locator") select element. Gets all option element IDs for selected options in the specified 29 getSelectedIds("Select Locator") select or multi-select element. Gets option index (option number, starting at 0) for selected option in 30 getSelectedIndex("Select Locator") the specified select element. Gets all option indexes (option number, starting at 0) for selected options in the specified select or 31 getSelectedIndexes("Select Locator") multi-select element. Gets option label (visible text) for selected option in the specified 32 getSelectedLable("Select Locator") select element. Gets all option labels (visible text) for selected options in the specified select or multi-select 33 getSelectedLables("Select Locator") element. Gets option value (value attribute) for selected option in the specified 34 getSelectedValue("Select Locator") select element. Gets all option values (value attributes) for selected options in the specified select or multi-select 35 getSelectedValues("Select Locator") element. Gets all option labels in the 36 getSelectOptions("Select Locator") specified select drop-down. Get execution speed (i.e., get the millisecond length of the delay following each selenium 37 getSpeed() operation).
  • 13. 38 getTable("Table Cell Address”) Gets the text from a cell of a table. 39 getText("Locator") Gets the text of an element. 40 getTitle() Gets the title of the current page. Gets the (whitespace-trimmed) value of an input field (or anything 41 getValue("Locator") else with a value parameter). Determine whether current/locator getWhetherThisFrameMatchFrameEx identify the frame containing this 42 pression("Current Frame","Target") running code Determine whether getWhetherThisWindowMatchWindow currentWindow String plus target Expression("Current identify the window containing 43 Window","Target") this running code. Simulates the user clicking the 44 goBack() "back" button on their browser. Briefly changes the backgroundColor of the specified 45 highlight("Locator") element yellow. 46 isAlertPresent() Has an alert occurred? Gets whether a toggle-button 47 isChecked("Locator") (checkbox/radio) is checked. 48 isConfirmationPresent() Has confirm() been called? Determines whether the specified input element is editable, ie hasn't 49 isEditable("Locator") been disabled. Verifies that the specified element 50 isElementPresent("Locator") is somewhere on the page. 51 isPromptPresent() Has a prompt occurred? Determines whether some option 52 isSomethingSelected("Locator") in a drop-down menu is selected. Verifies that the specified text pattern appears somewhere on the 53 isTextPresent("Pattern") rendered page shown to the user. Determines if the specified 54 isVisible("Locator") element is visible. 55 open("URL") Opens an URL in the test frame. Opens a popup window (if a window with that ID isn't already 56 openWindow("URL","WindowID") open). Simulates the user clicking the 57 refresh() "Refresh" button on their browser. Unselects all of the selected 58 removeAllSelections("Locator") options in a multi-select element. Remove a selection from the set of removeSelection("Locator","Option selected options in a multi-select 59 Locator") element using an option locator.
  • 14. select("Select Locator","Option Select an option from a drop-down 60 Locator") using an option locator. Selects a frame within the current 61 selectFrame("Locator") window. Selects a popup window; once a popup window has been selected, 62 selectWindow("WindowID") all commands go to that window. Set execution speed (i.e., set the millisecond length of a delay which will follow each selenium 63 setSpeed("Value") operation). Specifies the amount of time that Selenium will wait for actions to 64 setTimeout("Time") complete. Launches the browser with a new 65 start() Selenium session Ends the test session, killing the 66 stop() browser 67 submit("Form Locator") Submit the specified form. Sets the value of an input field, as 68 type("Locator","Value") though you typed it in. Uncheck a toggle-button 69 unCheck("Locator") (checkbox/radio) Runs the specified JavaScript waitForCondition("JavaScript","Timeo snippet repeatedly until it 70 ut") evaluates to "true". waitForFrameToLoad("Frame Waits for a new frame to load. 71 Address","Timeout") 72 waitForPageToLoad("Timeout") Waits for a new page to load. Waits for a popup window to 73 waitForPopUp("WindowID","Timeout") appear and load up. Gives focus to the currently 74 windowFocus() selected window Resize currently selected window 75 windowMaximize() to take up the entire screen Handling Keyboard and Mouse: S.No Command Description Press the Alt key and hold it down until AltUp() is called or a new 1 altKeyDown() page is loaded. 2 altKeyUp() Release the Alt key. 3 controlKeyDown() Press the Control key and hold it
  • 15. down until ControlUp() is called or a new page is loaded. 4 controlKeyUp() Release the Control key. Simulates a user pressing a key 5 keyDown("Locator","Key Sequence") (without releasing it yet). 6 keyUp("Locator","Key Sequence") Simulates a user releasing a key. Simulates a user pressing and 7 KeyPress("Locator","Key Sequence") releasing a key. Press the meta key and hold it down until MetaUp() is called or a 8 metaKeyDown() new page is loaded. 9 metaKeyUp() Release the meta key. Simulates a user pressing the mouse button (without releasing it 10 mouseDown("Locator") yet) on the specified element. Simulates a user pressing the mouseDownAt("Locator","Coordinate mouse button (without releasing it 11 String") yet) at the specified location. Simulates a user pressing the mouse button (without releasing it 12 mouseMove("Locator") yet) on the specified element. Simulates a user pressing the mouseMoveAt("Locator","Coordinate mouse button (without releasing it 13 String") yet) on the specified element. Simulates a user moving the mouse pointer away from the 14 mouseOut("Locator") specified element. Simulates a user hovering a 15 mouseOver("Locator") mouse over the specified element. Simulates the event that occurs when the user releases the mouse button (i.e., stops holding the button down) on the specified 16 mouseUp("Locator") element. Simulates the event that occurs when the user releases the mouse button (i.e., stops holding the mouseUpAt("Locator","Coordinate button down) at the specified 17 String") location. Press the shift key and hold it down until doShiftUp() is called or 18 shiftKeyDown() a new page is loaded. 19 shiftKeyUp() Release the shift key.
  • 16. S.No Object/Property Command 1 Text Box getValue(), getText(), isEditable(), isVisible(), type() 2 List Box getSelectedId(),getSelectedIndex(), , getSelectedLabel(),getSelectedValue(), getSelectOptions(), select() 3 Multi Select getSelectedIds(),getSelectedIndexes(), Element getSelectedLabels(),getSelectedValues(),isSomethin gSelected() 4 Radio Button check(), click(), isChecked() 5 Check Box Check(), click(),isChecked(), uncheck() 6 Button click() 7 Link click(), getAllLinks() 8 Text getText(),getBodyText() 9 Tables and Cells getTable() Consider this feature matrix : Selenium Selenium Selenium Selenium IDE RC Core Core HTA Browser Support Firefox Only Many All IE Only Requires Remote No No Yes No Installation Supports Yes Yes* Yes Yes HTTPS/SSL Supports Multiple Yes Yes* No Yes Domains Requires Java No Yes No No Saves Test No** Yes No Yes Results to Disk Language Selenese Many Selenese Selenese Support Only Only Only • *= experimental support is available in Selenium RC
  • 17. ** = theoretically possible, but not currently implemented