Selenium IDE commands are also known as Selenese. Selenese is the set of commands that perform the automation tests in Selenium IDE. Collection of these commands builds a Test Script. You can get the following benefits by using the wide-range of Selenese commands,
- Checking whether the target element is present in the page or not.
- Comparing the value of the text of an element or an input field.
- Clicking on links, dragging & dropping elements.
- Submitting forms, executing scripts and testing Ajax (Asynchronous JavaScript And XML ) functionality.
- Using conditional statements and loops (while & for each).
- Testing user interactions (simulation of mouse events), event handling, window handling, and a lot of other web application functionalities.
Types of Selenium IDE Commands
Selenium IDE commands basically fall in three categories. They are:
- Actions
- Accessors
- Assertions
Actions
Actions are Selenium IDE commands which perform some kind of action on the web application under test and change the state of the application. These commands tell like “click on the button”, “select the option from combo-box” or “type in the text-field” etc. If an Action fails or encounters any error, the current test execution gets stopped. Some of the widely used Actions commands are as follows.
Command | Argument | Description |
open | url | Opens a URL and waits for the page to load before it proceeds. This accepts both relative and absolute URLs. |
click | locator | Clicks on a target element (e.g., a link, button, checkbox, or radio button). |
click at | locator coord string | Clicks on a target element (e.g., a link, button, checkbox, or radio button). The coordinates are relative to the target element (e.g., 0,0 position is the top left corner of the element) and mostly used to check effects that depend on them. |
close | – | Closes the current window of the browser. It’s not necessary to close the initial window. Selenium IDE handles that by re-using it. |
Accessors
Accessors commands fetch the current state of the elements. These commands can store the value as a variable for later use. Some of the most used Accessors commands are as follows.
Command | Argument | Description |
store text | locator variable name | Gets the text of a specific element and stores it as variable for later use. This works for any element in the page that contains text. |
store title | – | Gets the title of the current window. |
store value | locator variable name | Gets the value of a specific element and stores it as variable for later use. This works for any input type element. |
Assertions
Assertions commands basically do the verification of the application state whether it conforms to the expected result or not. It helps the automation engineers to verify the state of the application. Assertions commands are of three categories:
- assert: Verifies the variable against the expected value. The test stops if assert fails.
- verify: Soft asserts the variable is an expected value. The test continues even if verify fails.
- wait for: Waits for a condition to be TRUE within the specified amount of time. Immediately after the condition becomes TRUE, it resumes execution. It fails if the condition is not TRUE within the specified time frame.
To get the list of all Selenium IDE commands, click here