Selenium IDE supports a wide range of Selenese Commands and we can use them to perform variety of actions on the web page. Let’s first understand what Selenium Command is. Through these commands we tell Selenium what action to perform on a Target. There are basically three types of commands :

1) Actions
2) Accessors
3) Assertions

Actions :

These type of commands are used to perform some actions on a web element. They directly interact with the web page by clicking on it or typing the parameter passed in Value field. “Type”, “click”, “clickAndWait”, “doubleClick” etc. are the examples of Action Commands.


Accessors :

To store the values in a variable, Accessors commands are used. These type of commands do not interact with web page or any element. Values stored in accessors can be used anywhere in the test script for assertion or verification purpose.

For Example, “storeAllButtons” command is an accessor, because it stores IDs of all buttons present on the web page and allows user to use later in the script.

Assertions :

Assertions also do not interact with the web elements. They verify if the provided conditions are fulfilled or not. There are three forms of Assertions,

– Assert : These commands verify the given condition is getting passed or not. Upon failure it aborts the execution.

– Verify : These commands also verify the given condition is getting passed or not. Upon failure it does not abort the execution, the execution continues and the particular command gets failed.

– WaitFor : These commands wait for the given condition to be passed before going further into the execution. For example “waitForElementPresent”, this command will wait for the element to be present(will return True if present) and than pursue with the following commands.

Now, let’s start with understanding of Commands in detail. I have not covered each and every commands supported by Selenium IDE, though we will focus on most frequently used ones.

Note : For better understanding keep Selenium IDE window open and try to execute each command by yourself.

open (url)
openWindow (url,windowID)
click (locator)
clickAt (locator,coordString)
doubleClick (locator)
doubleClickAt (locator,coordString)
windowMaximize ()
type (locator,value)
echo (message)
pause (waitTime)
goBack ()
refresh ()
setSpeed (value)
break ()
waitForPageToLoad (timeout)
waitForPopUp (windowID,timeout)
highlight (locator)
store (expression,variableName)
storeAllButtons (variableName)
storeAllLinks (variableName)
assignId (locator,identifier)
captureEntirePageScreenshot (filename,kwargs)
keyDown (locator,keySequence)
keyUp (locator,keySequence)

open

Open Command in Selenium IDE is mostly defined at starting of the script to hit the URL in the browser. The URL can be both absolute and relative. Relative URL is used
to open a specific web page on the same server if you have provided Base URL in Selenium IDE.

command = open
target = the URL you wish to open
value = null

openWindow

The command openWindow is used to tell Selenium IDE to open a popup window. Once the window is opened, it will not automatically set the focus on that window. For that we need to use another command “selectWindow”.

command = openWindow
target = the URL you wish to open
value = windowID – the JavaScript window ID of the window to select

Please make sure that Firefox is not preventing pop-up windows to open before executing this command.

click

To click on any web element(button, link, check-box, radio) this command is used. Please make sure to add “waitForPageToLoad” after this command if you are clicking on any element which leads to Page load.

command = click
target = web element locator
value = null

clickAt

clickAt command is very useful when you need to click on specific x,y position of a web element. As part of the value you need to provide (X,Y) coordinates of the web
element. Please make sure to add “waitForPageToLoad” after this command if you are clicking on any element which leads to Page load.

command = clickAt
target = web element locator
value = Specific (X,Y) position of the mouse event related to the element specified in the Target. Example, (10,10).

Tip : If “click” command is not working you can use “clickAt” command. It usually works.

doubleClick

This command simply double click on the the element specified in the Target. Please make sure to add “waitForPageToLoad” after this command if you are clicking on any element which leads to Page load.

command = doubleClick
target = web element locator
value = null

doubleClickAt

doubleClickAt command is very useful when you need to double click on specific x,y position of a web element. As part of the value you need to provide (X,Y) coordinates of the web element. Please make sure to add “waitForPageToLoad” after this command if you are clicking on any element which leads to Page load.

command = doubleClickAt
target = web element locator
value = Specific (X,Y) position of the mouse event related to the element specified in the Target. Example, (10,10).

windowMaximize

It will re-size your window to fit the entire screen.

type

Type is a very useful command to insert the value in the entry field.

command = type
target = web element locator
value = the value you wish to enter / type.

echo

It prints the message specified in the value field. Very useful command for debugging purpose.

command = echo
target = null
value = The message you wish to print

pause

This command is used to pause the execution process for specified amount of time. Please note that amount you provide in value field will be considered as milliseconds.

command = pause
target = null
value = Amount of time (in milliseconds) you wish to pause the execution.

goBack

This command is used to perform clicking “Back” button of the Browser.

refresh

This command is used to perform clicking “Refresh” button of the Browser.

setSpeed

By default Selenium IDE does not set any delay in execution i.e., the delay is set to 0 milliseconds. We can override this by using “setSpeed” command. Please note that the amount you provide in value field will be considered in milliseconds.

command = setSpeed
target = null
value = Amount of time (in milliseconds) you wish to delay.

break

Another command used for debugging, where Selenium IDE halts the execution and gives user the control to continue the execution.

waitForPageToLoad

There are many similar commands supported by Selenium with “AndWait” suffix, “clickAndWait”, “selectAndWait”, “typeAndWait” etc. You can use “waitForPageToLoad” command to put a specified amount of delay when the new page loads. Use this command immediately after the click action which triggers new page load event.

command = waitForPageToLoad
trget = null
value = timeout in milliseconds, after which this command will return with an error

waitForPopUp

This command is used to specify an amount of delay for a popup window to appear and load.

command = waitForPopUp
target = the JavaScript window ID of the window to select. Keeping it blank will focus on first popup window, but it’s advisable to give the window ID when dealing
with multiple popup windows.
value = timeout in milliseconds, after which this command will return with an error.

highlight

When executing this command, Selenium IDE highlights the specified command with yellow color. This command is used for debugging purpose.

command = highlight
target = locator of the web element you wish to highlight.
value = null.

store

This is a very useful command to store the expression (value) to use for future reference.

command = store
target = the expression / string you wish to store
value = name of the parameter in which you wish to store the expression.

storeAllButtons

This command returns the IDs of all buttons on the page.

This command returns the IDs of all links on the page.

assignId

To set the temporary ID attribute to the specified element. Purpose of this command is to locate the same element in future through this assigned ID rather than the complex / slow XPath expression.

command = assignId
target = locator of the web element
value = a string to be used as an ID for the specified element.

captureEntirePageScreenshot

This command is used to capture the entire screen at any point of time during the execution. In target field you will need to provide the physical path of the directory including the file name.

keyDown

Performs the action of User pressing the key. (without releasing it yet).

command = keyDown
target = locator of a web element.
value = Either a string or single character followed by the numeric keycode (ASCII) of the key to be pressed. Example : \40

keyUp

Performs the action of User releasing the key.

command = keyUp
target = locator of a web element.
value = Either a string or single character followed by the numeric keycode (ASCII) of the key to be released. Example : \40.

By using these commands in Selenium IDE you will be able to perform all basic actions.

I have prepared the list based on my understanding, still if you feel any important command is missed please let me know through comments or Contact Us. I will analyse and add those commands to the list.


Share This Article :