Selenium IDE | A step by step Guide
Last updated on 28th Jun 2020, Blog, General
- 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.
- 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.
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.
Features of Selenium IDE :
It is located at the top most portion of the IDE. The most commonly used menus are the File, Edit, and Options menus.
- 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.
- 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)
- 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”.
- The newly inserted command or comment will be placed on top of the currently selected line.
- Commands are colored black.
- Comments are colored purple.
- It provides the interface for configuring various settings of Selenium IDE.
- We shall concentrate on the Options and Clipboard Format options.
- 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.
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.
- 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 http://addons.mozilla.org/en-US/firefox/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.
Base URL Bar
- 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 http://newtours.demoaut.com as our Base URL. It is the site for Mercury Tours, a web application maintained by HP 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 http://newtours.demoaut.com. 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.
Get Practical Oriented Selenium Training to Meet the Industry Needs
- Instructor-led Sessions
- Real-life Case Studies
This controls the speed of your Test Script Execution.
This starts/ends your recording session.Each browser action is entered as a Selenese command in the Editor.
Play the entire test suite
This will sequentially play all the test cases listed in the Test Case Pane.
Play the current test case
This will play only the currently selected test case in the Test Case Pane.
This will pause or resume your playback.
This button will allow you to step into each command in your test script.
Apply rollup rules
This is an advanced functionality. It allows you to group Selenese commands together and execute them as a single action.
You can think of the editor as the place where all the action happens. It is available in two views: Table and Source.
- 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.
- 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.
- It displays the steps in HTML (default) format.
- It also allows you to edit your script just like in the Table View.
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:
- 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.
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.
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.
- 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.
Benefits of Using Selenium IDE
- Provides you the capability of automatically recording your test cases based upon the interactions with the browser
- Gives developers greater flexibility in executing the test cases. Either the test developer can run the entire test suite consisting of multiple test cases or execute a single test case
- Operates on the basis of the rich set of Selenese commands, which helps the IDE understand what needs to be done
- Allows the test developers to set breakpoints for the purpose of debugging particular test cases
- Test cases can be re-used using the run command. (e.g. allowing you to re-use the logic of login or reload on multiple places in the entire suite)
- Use of multiple-locators for each element in the IDE ensures successful
Limitations of Selenium IDE
- Not suitable for testing extensive data
- Incapable of handling multiple windows
- Connections with the database can not be tested
- Cannot handle the dynamic part of web-based applications
- Does not support capturing of screenshots on test failures
- No feature available for generating result reports
Best Selenium Training Course from Real-Time Experts to Develop Your SkillsWeekday / Weekend BatchesSee Batch Details
Master the Selenium Suite
To learn more about Selenium and how the various suite components work, check out Simplilearn’s video on “Selenium Tutorial for Beginners”.
Interested in making a career as an automation engineer? A certification course will come in handy, so check out Simplilearn’s Selenium Certification Training Course that enables you to master the complete Selenium suite.
The certification course is ideal for:
- Test Managers
- Test Engineers
- Test Leads
- Test Analysts
- QA Engineers
- Software Developers
- Engineers who want to learn automation testing
Advancements with New Selenium IDE
In 2017, Firefox upgraded to a new Firefox 55 version, which no longer supported Selenium IDE. Since then, the original version of Selenium IDE ceased to exist. However, Applitools rewrote the old Selenium IDE and released a new version recently.
This new version comes with several new advancements:
- Support for both Chrome and Firefox
- Improved locator functionality
- Parallel execution of tests using Selenium command line runner
- Provision for control flow statements
- Automatically waits for the page to load
- IDE has a debugger which allows step execution, adding breakpoints
- Support for code exports
Working Principle of Selenium IDE
Recording : IDE allows the user to record all of the actions performed in the browser. These recorded actions as a whole are the test script.
Playing Back : The recorded script can now be executed to ensure that the browser is working accordingly. Now, the user can monitor the stability and success rate.
Saving : The recorded script is saved with a “.side” extension for future runs and regressions.