Actions are commands that manipulate the state of the application. Upon execution, if an action fails the execution of the current test is stopped. For Example, "click a link" and "select an option".
The following table lists the Selenium action commands that are used very frequently, however the list is note exhaustive.
| Sr.No. | Command/Syntax & Description |
|---|---|
| 1 |
click (locator) Clicks on a link, button, checkbox or radio button |
| 2 |
clickAt (locator,coordString) Clicks on an element with the help of locator and co-ordinates |
| 3 |
close() Simulates the user clicking the "close" button in the title bar of a popup window or tab. |
| 4 |
contextMenuAt (locator,coordString) Simulates opening the context menu of the specified element from a specified location |
| 5 |
doubleClick (locator) Double clicks on a webelement based on the specified element. |
| 6 |
dragAndDrop (locator,movementsString) Drags an element and then drops it based on specified distance. |
| 7 |
dragAndDropToObject (Dragobject,dropobject) Drags an element and drops it on another element. |
| 8 |
echo (message) Prints the specified message on console which is used for debugging. |
| 9 |
fireEvent (locator,eventName) Explicitly simulate an event, to trigger the corresponding "onevent" handler |
| 10 |
focus (locator) Move the focus to the specified element |
| 11 |
highlight (locator) Changes the background Color of the specified element to yellow Briefly which is useful for debugging purposes. |
| 12 |
mouseDown (locator) Simulates a user pressing the left mouse button on the specified element. |
| 13 |
mouseDownAt (locator,coordString) Simulates a user pressing the left mouse button at the specified location on the specified element. |
| 14 |
mouseUp (locator) Simulates the event that occurs when the user releases the mouse button |
| 15 |
mouseUpAt (locator,coordString) Simulates the event that occurs when the user releases the mouse button at the specified location. |
| 16 |
open (url) Opens an URL in the specified browser and it accepts both relative and absolute URLs. |
| 17 |
openWindow (url,windowID) Opens a popup window. After opening the window, user need to activate it using the selectWindow command. |
| 18 |
pause (waitTime) Waits for the specified amount of time (in milliseconds) |
| 19 |
refresh() Simulates the user clicking the "Refresh" button on their browser. |
| 20 |
select (selectLocator,optionLocator) Select an option from a drop-down using an option locator. |
| 21 |
selectWindow (windowID) Selects a popup window using a window locator; once a popup window has been selected, all focus shifts to that window. |
| 22 |
store (expression,variableName) The name of a variable in which the result is to be stored and expression is the value to store |
| 23 |
type (locator,value) Sets the value of an input field, similar to user typing action. |
| 24 |
typeKeys (locator,value) Simulates keystroke events on the specified element, as though you typed the value key-by-key. |
| 25 |
waitForCondition (script,timeout) Executes the specified JavaScript snippet repeatedly until it evaluates to "true". |
| 26 |
waitForPageToLoad (timeout) Waits for a new page to load. |
| 27 |
waitForPopUp (windowID,timeout) Waits for a popup window to appear and load. |
| 28 |
windowFocus() Gives focus to the currently selected window |
| 29 |
windowMaximize() Resize currently selected window to take up the entire screen |

