Selenium Tutorial : IDE

3. Selenium IDE

3.1. Overview

Figure 1. Selenium IDE

images/SeleniumIDE_walkthrough1.png


Selenium IDE features:

  • record/play mechanism: create/edit tests by recording the user actions on the page
  • Debugging feature with step-by-step and breakpoints
  • Page abstraction capabilities
  • Automatic assertions for the page title
  • An extensibility feature allowing the use of plugins or user extensions that extend the capabilities of Selenium IDE

3.2. Presentation

At startup, Selenium IDE looks like this:

Figure 2. Selenium IDE

images/SeleniumIDE_1_0_7.png


The interface features the following elements:

  • An action bar to control the test (1)

    Figure 3. Selenium IDE test control

    images/SeleniumIDE_actionbar.png


    1. The base url of the application
    2. Test speed
    3. Run test-suite
    4. Run the selected test case only
    5. Pause the test
    6. Next step (while paused only)
    7. Open Selenium TestRunner
    8. Apply rollups (see Section 9.5, ?Rollups?)
    9. Start/Stop recording
  • A test-suite tool (2)

    Shows the tests in the current test-suite along with the results.

  • A test editor (3)

    Figure 4. Selenium IDE test editor area

    images/SeleniumIDE_testpanel.png


    1. The test steps
    2. The command of the current step
    3. The locator argument
    4. ?Find? button highlights the target of the locator on the page
    5. The value argument
  • A tool panel (4)

    Figure 5. Selenium IDE tool panel

    images/SeleniumIDE_toolpanel.png


    1. Log: shows the execution log of the current tests and displays errors
    2. Reference: displays the documentation of the command actually selected
    3. UI-Element: diplays the ui-element mappings actually in use
    4. Rollup: shows rollup rules
    5. Stored-vars (plugin, see Section 13.2, ?Selenium helper tools? ): displays current stored variables
    6. Log level (only with log panel): customize the verbosity of the log
    7. Clear log (only with log panel): clears the log

3.3. Export Features

A most interesting feature of Selenium IDE: export to Selenium RC. Selenium IDE is able to export test cases in the following formats:

  • Java (Junit 3/4 and TestNG)
  • Groovy (Junit)
  • C#
  • Perl
  • Python
  • PHP
  • Ruby (RSpec and Test/Unit)

You can export test-cases or the entire test-suite.

3.4. Installation

Selenium IDE is distributed as Firefox extension:

  1. Go to the Selenium website (http://www.seleniumhq.org) or the Firefox add-ons website (http://addons.mozilla.org)
  2. Download the latest release (1.0.8 at the time of writing)
  3. Follow the instructions and restart Firefox
  4. Selenium IDE is accessible from the ?Tools? Menu of Firefox

3.5. Lab 1

  1. Open Firefox, go to http://www.google.com. Then, open Selenium IDE (?Tools? ? ?Selenium IDE?)

    images/SeleniumIDE_walkthrough1.png
  2. Make sure the record button is activated, then type in the search field pizza.

    images/SeleniumIDE_walkthrough2_fx.png
  3. Click anywhere on the page or press tab to validate the entry. The Selenium IDE window now looks like this:

    images/SeleniumIDE_walkthrough2_ide.png
  4. Click the Google Search button. You can see the click command appear in the IDE.

    • On the result page, do a right-click and select the assertTitle command:

      images/SeleniumIDE_walkthrough3_fx.png
  5. The command appears in the IDE window!

    images/SeleniumIDE_walkthrough3_ide.png

3.6. Discussion

  • What problems and limitations do you foresee when using this tool?