• Selenium Video Tutorials

Selenium IDE - Actions Commands



All commands in Selenium IDE are known as the Selenese commands. With the help of the Selenese Commands we perform every activity on a web application. Selenese commands are of three types −

Basic Actions Commands

The various types of action commands are listed below −

  • click(locator) − This command is used to click on a link, button, checkbox or radio button.
  • check(locator) − This command is used to check a radio button or checkbox.
  • uncheck(locator) − This command is used to uncheck a radio button or checkbox.
  • choose cancel on next confirmation − This command is used to deal with the next confirmation alert. It will cancel it.
  • choose cancel on next prompt − This command is used to deal with the next alert prompt . It will cancel it.
  • choose ok on next confirmation − This command is used to deal with the next confirmation alert. It will accept it.
  • click At(locator, coordinateString) − This command is used to click on a link, button, checkbox or radio button at a specific location.
  • close − This command is used to close the current window.
  • debugger − This command is used to pause test execution for debugging tests.
  • double click(locator) − This command is used to double click on a link, button, checkbox or radio button.
  • double click at(locator) − This command is used to double click on a link, button, checkbox or radio button at a specific location.
  • drag and drop to object(source locator, destination locator) − This command is used to drag an element from the source locator to the destination locator.
  • echo(message) − This command is used to print the message. It is most commonly used for debugging purposes.
  • edit content(locator, value) − This command is used to enter the value of an editable web element.
  • execute script(script, variable name) − This command is used to execute a JavaScript command within the window or frame in focus.
  • execute async script(script, variable name) − This command is used to execute an async JavaScript command within the window or frame in focus.
  • mouse down(locator) − This command is used to simulate pressing the left mouse button by user(without release).
  • mouse down at(locator, coordinateString) − This command is used to simulate pressing the left mouse button by user(without release) at a specific location.
  • mouse move at(locator, coordinateString) − This command is used to simulate pressing the mouse button by the user at a specific location.
  • mouse out(locator) − This command is used to simulate moving the pointer of the mouse away by user.
  • mouse over(locator) − This command is used to simulate mouse hovering on an element identified by the locator.
  • mouse up(locator) − This command is used to simulate release of the mouse button.
  • mouse up at(locator, , coordinateString) − This command is used to simulate release of mouse button at a specific location.
  • open(url) − This command is used to open a url and wait for the page to load.
  • pause(wait time) − This command is used to stop the execution for some time.
  • remove selection(locator, option) − This command is used to deselect an option in a multi-select dropdown.
  • run(test case) − This command is used to run a test case.
  • select(locator, option) − This command is used to select an option in a dropdown.
  • select frame(locator) − This command is used to select a frame within the window in focus.
  • select window(window handle) − This command is used to select a popup window with the help of the window handle id.
  • set window size(resolution) − This command is used to specify the window size of the browser along with the browser interface.
  • type(locator) − This command is used to enter text in an input box.

Example

Let us take an example of the below page, where we would launch the application and enter text Selenium in the input box near Name: using the action commands open, type, and close.

Selenium Actions Commands 1

The steps to be followed are listed below −

Step 1 − Go through the Steps 1 to 4 as described in the link Selenium IDE Store Variables.

Step 2 − The workspace is ready in the Selenium IDE now.

Step 3 − Enter open in the Command field, and Selenium Automation Practice Form in the Target field, to launch the application.

Step 4 − Enter type in the Command field, id=name in the Target field, and Selenium in the Value field. Please note, id=name is the locator value of the input box and Selenium is the value to be entered.

Step 5 − Enter close in the Command field to close the browser window.

Selenium Actions Commands 4

Step 6 − Click on the three dots appearing at the left pane, then select the Rename option.

Step 7 − Enter a name, say Test7 under the Rename Test case field, then click on Rename. The entered name would appear on the left of Selenium IDE.

Selenium Actions Commands 5

Step 8 − Click on the Run all tests from the top, and wait for the test execution to complete. In our example, we would see Runs: 1, Failures: 0, and a green bar denoting the test ran successfully without any failures. Also, the message Test7 completed successfully appeared under the Log.

Selenium Actions Commands 6

In the example above, we entered the text Selenium in the input box using the id locator beside the First Name: label which appeared under the Log. Besides, we got a green tick beside the test case name - Test7 at the top, signifying a passed test. All these were performed successfully using the actions commands like open, type, and close.

Conclusion

This concludes our comprehensive take on the tutorial on Selenium IDE Actions Commands. Weve started with describing various actions commands and an example to walk through how to use the actions commands along with Selenium. This equips you with in-depth knowledge of the actions commands in Selenium IDE. It is wise to keep practicing what youve learned and exploring others relevant to Selenium to deepen your understanding and expand your horizons.

Advertisements