Selenium –IDE Commands (SELENESE):
Selenese commands are the set of commands used in Selenium IDE. Selenese command has two parameters target and value.
Selenese command tests the existence of UI elements based on their HTML tags, test for broken links, input fields, submitting forms, and check for specific content, Selection list options, and table data among other things.
Selenium commands support testing for Ajax functionality, window size, mouse position, and alerts, pop up windows, event handling, and many other web-application features.
We have three types of Selenium IDE commands:
Actions command directly interact with page element, e.g.-
|Type/send keys||Edit Box|
|Click||Check box, Radio button|
|Click and Wait||Link|
|Click and Wait||Image|
If an Action command fails, it has an error, and then the execution of the current test is stopped.
Some commonly used actions command is as follows:
|open (url)||Open a browser using a URL|
|type /send keys (locator, value)||It is a sequence of character use while performing an action on the edit box.|
|click (locator)||Click command is enabled when the user clicks on a link, button, checkbox, or radio button.|
|clickAt (locator,cordString)||It is enabled when the user clicks on an element with the help of the locator and its co-ordinates.|
|doubleClick (locator)||This command is enabled when the user double clicks on a web element.|
|focus (locator)||It moves the focus to the specified element.|
|highlight (locator)||It is used to change the background color of the specified element.|
|close()||The user is clicking the close button in the title bar of a popup window or tab.|
|store (expression,variableName)||Specifies the name of a variable in which the result is to be stored, and expression is the value which is to be stored.|
Accessor’s commands are used to examine the state of the application and store the value in a variable.
The most commonly used Accessors commands are as follows:
|storeTitle (variableName)||storeTitle command helps us to get the title of the current page.|
|storeText (locator, variableName)||storeTextcommand is used to get the text of an element.|
|storeValue (locator,variableName)||It is used to get the value of an input field.|
|storeTable (tableCellAddress, variableName)||storeTable command helps us to get the text from a cell of a table.|
|storeLocation (variableName)||To get the absolute URL of the current page.|
|storeElementIndex (locator, variableName)||This command gets the relative index of an element to its parent (starting from 0).|
|storeBodyText (variableName)||To get the entire text of the page.|
|storeAllButtons (variableName)||It will return the IDs of all buttons on the page.|
|storeAllFields (variableName)||Return the IDs of all input fields on the page.|
|storeAllLinks (variableName)||It will return the IDs of all links on the page.|
These commands are used to verify if a specific condition met.
Assertions divided into three modes –
The most commonly used Assertions commands are:
|verifySelected(selectLocator, optionLocator)||Verify that the selected option of a drop-down satisfies the optionSpecifier.|
|verifyAlert (pattern)||It is used to verify the alert text with the help of accessorstoreAlert.|
|verifyAllButtons (pattern)||It is used to verify the button with the help of accessorstoreAllButtons.|
|verifyAllLinks (pattern)||Verify all links with the help of accessorstoreAllLinks.|
|verifyBodyText(pattern)||It is used to verify the body text with the help of accessorstoreBodyText.|
|verifyAttribute(attributeLocator, pattern)||Verify an attribute of an element with the help of accessorstoreAttribute.|
|waitForErrorOnNext (message)||Enables Waits for error; with the help of accessorassertErrorOnNext.|
|waitForAlert (pattern)||It is used to enable waits for the alert: accessorstoreAlert.|
|verifyAllWindowIds (pattern)||Verifies the window id; with the help of accessorstoreAllWindowIds.|