Learning Selenium… Selenium IDE

Learning Selenium… Selenium IDE

Selenium IDE is a Firefox add-on, which allows simple record and playback of browser interaction. Tests are recorded as scripts in Selenese, a special test scripting language for Selenium.

The easiest way to understand how Selenium IDE works is to download it and install it in Firefox. Once installed, you turn it on via the Firefox Tools menu, Selenium IDE option. The IDE will then appear, as shown below.

Selenium IDE Screenshot

The main parts of this window are:

  • The Menu options – File, Edit, Actions, Options, Help
  • The Base URL input
  • The Playback and Record buttons row
  • Then under this, to the left, the Test Case list
  • To the right, the Command window, listing the Commands in the current script, with focus on the current Command also shown
  • Then at the bottom, the Log/Reference/UI-Element/Rollup area

Selenium IDE – Recording

To start recording a script, first set the Base URL e.g. http://www.bbc.co.uk/
Then press the big red Record button to the right.
From this point, any actions made within the Firefox Browser will be saved and added to your script. To end recording, press the same red Record button.

 

Selenium IDE – Playback

To playback a script, you can either playback the current script, using the ‘Play current test case’ button or use the same option name in the Action menu. The script will playback and the resulting actions will be performed in the Firefox browser and results shown on the IDE screen (e.g. any errors highlighted in red)

 

Selenium IDE – Commands Window

The actions you made while in the Firefox browser, will then be added to the Commands window list, as Selenese commands.
These Selenese commands are represented with three separate elements – Command, Target and Value.
Some example entries:-
Command             Target                Value
open                /search 
clickAndWait        css=span.tl > h3.r > a.l
verifyTextPresent   verifyTextPresent

In the Command list, you can edit the entries as required and also use the self-explanatory right-click options Insert New Command and Insert New Comment.

Selenium IDE – File Menu Options

Using the File menu, you can save Test Cases and Test Suites (a collection of Test Cases) to HTML files.

A great option is Export Test Case As… which allows you to export your Test Case commands out to which ever programming language / scripting language you’re using, including Java, Python, C# and Ruby.

Selenium IDE – Example Script Output

Below is a simple script in HTML format (basically a HTML table) and followed by the same script in Python.

Selenium IDE – HTML Format Script Output

Selenium IDE – Python Format Script Output

 

 

2017-01-10T21:29:22+00:00August 8th, 2012|Categories: Development, open source, Selenium, Software Testing|Tags: , , , |