Selenium IDE Tutorial

⚡ Smart Summary

Selenium IDE is the record-and-playback tool of the Selenium suite, built for prototyping tests rather than maintaining large suites, and its panes cover recording, editing, running and inspecting every Selenese command.

  • 🔘 Purpose: The IDE records browser actions as Selenese commands and replays them without any programming.
  • ☑️ Scope: Treat it as a prototyping tool, then export the script for a maintainable framework.
  • Menu bar: File handles create, open, save and export; Edit inserts new commands and comments.
  • 🧪 Options: The Options dialog sets the default timeout, the base URL behaviour and the locator build order.
  • 🛠️ Editor: Table View is where commands, targets and values are entered; Source View shows the same script as markup.
  • 📊 Feedback panes: The Log Pane reports Debug, Info, Warn and Error messages while the Reference Pane explains the selected command.
  • 🚀 Today: The current IDE is a Chrome, Firefox and Edge extension that saves projects as a single .side file.

Selenium IDE tutorial covering its panes, menus and toolbar

What is Selenium IDE?

Selenium IDE (Integrated Development Environment) is the simplest tool in the Selenium Suite. It is a Firefox add-on that creates tests very quickly through its record-and-playback functionality. This feature is similar to that of QTP. It is effortless to install and easy to learn.

⚠️ A note on versions: the Firefox add-on pictured throughout this article was retired. The tool lives on as a Chrome, Firefox and Edge browser extension that keeps record-and-playback but rearranges the interface and saves a project as a single .side file. Every original screen and setting below is preserved as published.

Because of its simplicity, Selenium IDE should only be used as a prototyping tool, not an overall solution for developing and maintaining complex test suites.

Though you will be able to use Selenium IDE without prior knowledge in programming, you should at least be familiar with HTML, JavaScript, and the DOM (Document Object Model) to utilize this tool to its full potential. Knowledge of JavaScript will be required when we get to the section about the Selenese command “runScript.”

Selenium IDE supports autocomplete mode when creating tests. This feature serves two purposes:

  • It helps the tester to enter commands more quickly.
  • It restricts the user from entering invalid commands.

Selenium IDE Features

The labelled screen below identifies every region referenced in the rest of this article.

Selenium IDE window with the menu bar, base URL bar, toolbar, test case pane, editor and log pane labelled

Menu Bar

It is located at the top most portion of the IDE. The most commonly used menus are the File, Edit, and Options menus.

File menu

  • It contains options to create, open, save and close tests.
  • Tests are saved in HTML format.
  • The most useful option is “Export” because it allows you to turn your Selenium IDE test cases into file formats that can run on Selenium Remote Control and WebDriver
  • “Export Test Case As…” will export only the currently opened test case.
  • “Export Test Suite As…” will export all the test cases in the currently opened test suite.

The expanded File menu below shows both export entries side by side.

Selenium IDE File menu expanded showing Export Test Case As and Export Test Suite As

  • As of Selenium IDE v1.9.1, test cases can be exported only to the following formats:
    • .cs (C# source code)
    • .java (Java source code)
    • .py (Python source code)
    • .rb (Ruby source code)

Exporting rewrites each Selenese row as a statement in the chosen language, as this HTML-to-Java comparison shows.

Selenese HTML test case shown beside the equivalent exported Java source code

Note: Selenium Remote Control was removed in Selenium 3, so an exported RC script no longer runs. The current IDE exports WebDriver code instead.

Edit Menu

  • It contains usual options like Undo, Redo, Cut, Copy, Paste, Delete, and Select All.
  • The two most important options are the “Insert New Command” and “Insert New Comment”.

Selenium IDE Edit menu with Insert New Command and Insert New Comment highlighted

The newly inserted command or comment will be placed on top of the currently selected line.

Editor grid before and after inserting a new command above the selected line

  • Commands are colored black.
  • Comments are colored purple.

The colour difference makes an inserted comment easy to pick out in a long script.

Editor rows showing a black Selenese command next to a purple comment line

Options menu

It provides the interface for configuring various settings of Selenium IDE.

We shall concentrate on the Options and Clipboard Format options.

Clipboard Format submenu listing every available code-snippet format

Clipboard Format

  • The Clipboard Format allows you to copy a Selenese command from the editor and paste it as a code snippet.
  • The format of the code follows the option you selected here in Clipboard Format’s list.
  • HTML is the default selection.

For example, when you choose Java/JUnit 4/WebDriver as your clipboard format, every Selenese command you copy from Selenium IDE’s editor will be pasted as Java code. See the illustration below.

Selenese command copied from the editor and pasted as a Java WebDriver statement

Selenium IDE Options dialog box

You can launch the Selenium IDE Options dialog box by clicking Options > Options… on the menu bar. Though there are many settings available, we will concentrate on the few important ones.

Selenium IDE Options dialog with the timeout, extensions, base URL and record settings labelled

  • Default Timeout Value. This refers to the time that Selenium has to wait for a certain element to appear or become accessible before it generates an error. Default timeout value is 30000ms.
  • Selenium IDE extensions. This is where you specify the extensions you want to use to extend Selenium IDE’s capabilities. You can visit addons.mozilla.org and use “Selenium” as a keyword to search for the specific extensions.
  • Remember base URL. Keep this checked if you want Selenium IDE to remember the Base URL every time you launch it. If you uncheck this, Selenium IDE will always launch with a blank value for the Base URL.
  • Autostart record. If you check this, Selenium IDE will immediately record your browser actions upon startup.
  • Locator builders. This is where you specify the order by which locators are generated while recording. Locators are ways to tell Selenium IDE which UI element should a Selenese command act upon. In the setup below, when you click on an element with an ID attribute, that element’s ID will be used as the locator since “id” is the first one in the list. If that element does not have an ID attribute, Selenium will next look for the “name” attribute since it is second in the list. The list goes on and on until an appropriate one is found.

Dragging an entry up or down this list changes which attribute the recorder reaches for first.

Locator builders list showing the priority order used when the recorder generates a locator

Base URL Bar

Every relative address in a script is resolved against this field.

Base URL bar of Selenium IDE holding the address of the application under test

  • It has a dropdown menu that remembers all previous values for easy access.
  • The Selenese command “open” will take you to the URL that you specified in the Base URL.
  • In this tutorial series, we will be using demo.guru99.com/test/newtours/ as our Base URL. It is the site for Mercury Tours, a demo web application used here for web testing purposes. We shall be using this application because it contains a complete set of elements that we need for the succeeding topics.
  • The Base URL is very useful in accessing relative URLs. Suppose that your Base URL is set to the Mercury Tours address above. When you execute the command “open” with the target value “signup,” Selenium IDE will direct the browser to the sign-up page. See the illustration below.

open command with the relative target signup resolving against the configured base URL

Toolbar

The toolbar holds the recording and playback controls. Each button and what it does is listed below.

Playback speed slider Playback Speed. This controls the speed of your Test Script Execution.
Record button Record. This starts/ends your recording session. Each browser action is entered as a Selenese command in the Editor.
Play entire test suite button Play entire test suite. This will sequentially play all the test cases listed in the Test Case Pane.
Play current test case button Play current test case. This will play only the currently selected test case in the Test Case Pane.
Pause and resume button Pause/Resume. This will pause or resume your playback.
Step button Step. This button will allow you to step into each command in your test script.
Apply rollup rules button Apply rollup rules. This is an advanced functionality. It allows you to group Selenese commands together and execute them as a single action.

Test Case Pane

Test case pane listing open test cases with pass and fail colour coding and a run summary

  • In Selenium IDE, you can open more than one test case at a time.
  • The test case pane shows you the list of currently opened test cases.
  • When you open a test suite, the test case pane will automatically list all the test cases contained in it.
  • The test case written in bold font is the currently selected test case
  • After playback, each test case is color-coded to represent if it passed or failed.
  • Green color means “Passed.”
  • Red color means “Failed.”
  • At the bottom portion is a summary of the number of test cases that were run and failed.

Editor

You can think of the editor as the place where all the action happens. It is available in two views: Table and Source.

Table View

  • Most of the time, you will work on Selenium IDE using the Table View.
  • This is where you create and modify Selenese commands.
  • After playback, each step is color-coded.

Editor in Table View with executed steps colour coded after playback

  • To create steps, type the name of the command in the “Command” text box.
  • It displays a dropdown list of commands that match with the entry that you are currently typing.
  • Target is any parameter (like username, password) for a command and Value is the input value (like tom, 123pass) for those Targets.

Command, Target and Value fields of the Selenium IDE table editor

Source View

  • It displays the steps in HTML (default) format.
  • It also allows you to edit your script just like in the Table View.

Editor in Source View showing the same test case as an HTML Selenese table

Log Pane

The Log Pane displays runtime messages during execution. It provides real-time updates as to what Selenium IDE is doing.

Logs are categorized into four types:

  • Debug – By default, Debug messages are not displayed in the log panel. They show up only when you filter them. They provide technical information about what Selenium IDE is doing behind the scenes. It may display messages such as a specific module has done loading, a certain function is called, or an external JavaScript file was loaded as an extension.
  • Info – It says which command Selenium IDE is currently executing.
  • Warn – These are warning messages that are encountered in special situations.
  • Error – These are error messages generated when Selenium IDE fails to execute a command, or if a condition specified by “verify” or “assert” command is not met.

Log pane dropdown listing the Debug, Info, Warn and Error message types

Logs can be filtered by type. For example, if you choose to select the “Error” option from the dropdown list, the Log Pane will show error messages only.

Log pane filtered to Error so only failed command messages remain visible

Reference Pane

The Reference Pane shows a concise description of the currently selected Selenese command in the Editor. It also shows the description about the locator and value to be used on that command.

Reference pane describing the selected Selenese command with its target and value arguments

UI-Element Pane

The UI-Element is for advanced Selenium users. It uses JavaScript Object Notation (JSON) to define element mappings. The documentation and resources are found in the “UI Element Documentation” option under the Help menu of Selenium IDE.

Help menu of Selenium IDE with the UI Element Documentation entry

An example of a UI-element screen is shown below.

UI-Element pane holding a JSON element map for an application under test

Rollup Pane

Rollup allows you to execute a group of commands in one step. A group of commands is simply called as a “rollup.” It employs heavy use of JavaScript and UI-Element concepts to formulate a collection of commands that is similar to a “function” in programming languages.

Rollups are reusable; meaning, they can be used multiple times within the test case. Since rollups are groups of commands condensed into one, they contribute a lot in shortening your test script.

Several Selenese steps condensed into a single rollup command in the editor

An example of how the contents of the rollup tab look like is shown below.

Rollup pane showing the JavaScript definition behind a reusable rollup rule

The rollup and UI-Element panes have no counterpart in the current extension; control-flow commands and code export fill that role now.

FAQs

A single file with a .side extension holds the whole project — every test, every suite and the base URL. That replaces the old model of one HTML file per test case, and it makes the project easy to commit to version control.

Yes. Playback inside the extension uses the browser it is installed in, but the command-line runner executes a saved project against other browsers and fits into a build pipeline, which the in-browser player cannot do.

The current IDE ships control-flow commands including if, else if, else, while, times, do, repeat if and for each. That covers branching and looping in a recorded script without the JavaScript workarounds the old rollup feature required.

The recorder stores several candidate locators for each element. During playback the alternatives are tried until one succeeds, so a changed id does not necessarily break the step. Persistent failures still mean the locator list needs editing by hand.

Right-clicking a test or suite offers WebDriver code for C# NUnit, C# xUnit, Java JUnit, JavaScript Mocha, Python pytest and Ruby RSpec. An optional toggle adds comments tracing each generated line back to its recorded step.

Machine learning is mainly applied to the weakest part of recorded tests: locators. Self-healing engines rank several candidate selectors and swap in a working one when markup shifts, and similar models cluster repeated failures to separate real defects from timing noise.

It is well suited to the cleanup pass. Exported code is one long linear method, and Copilot will refactor it into page objects, pull hard-coded data into fixtures and replace fixed pauses with explicit waits. Review the locators it keeps.

As soon as tests need shared setup, data files, reporting or reuse across suites. The IDE is excellent for proving a scenario quickly; a coded Selenium framework is what keeps hundreds of those scenarios maintainable.

Summarize this post with: