Selenium Commands - Accessors


Advertisements

Accessors evaluate the state of the application and store the results in a variable which are used in assertions. For Example, "storeTitle".

The following table lists the Selenium accessors that are used very frequently, however the list is not exhaustive.

Sr.No. Command/Syntax & Description
1

assertErrorOnNext (message)

Pings Selenium to expect an error on the next command execution with an expected message.

2

storeAllButtons (variableName)

Returns the IDs of all buttons on the page.

3

storeAllFields (variableName)

Returns the IDs of all input fields on the page.

4

storeAllLinks (variableName)

Returns the IDs of all links on the page.

5

storeAllWindowIds (variableName)

Returns the IDs of all windows that the browser knows about in an array.

6

storeAllWindowTitles (variableName)

Returns the names of all windows that the browser knows about in an array.

7

storeAllWindowNames (variableName)

Returns the titles of all windows that the browser knows about in an array.

8

storeAttribute (attributeLocator, variableName)

Gets the value of an element attribute. The value of the attribute may differ across browsers.

9

storeBodyText (variableName)

Gets the entire text of the page.

10

storeConfirmation (variableName)

Retrieves the message of a JavaScript confirmation dialog generated during the previous action.

11

storeElementIndex (locator, variableName)

Get the relative index of an element to its parent (starting from 0).

12

storeLocation (variableName)

Gets the absolute URL of the current page.

13

storeSelectedIds (selectLocator,variableName)

Gets all element IDs for selected options in the specified select or multi-select element.

14

storeSelectedIndex (selectLocator, variableName)

Gets index (option number, starting at 0) for selected option in the specified select element.

15

storeSelectedLabel (selectLocator, variableName)

Gets label (visible text) for selected option in the specified select element..

16

storeSelectedValue (selectLocator,variableName)

Gets value (value attribute) for selected option in the specified select element.

17

storeSelectOptions (selectLocator,variableName)

Gets all labels in the specified select drop-down.

18

storeTable (tableCellAddress, variableName)

Gets the text from a cell of a table. The cellAddress syntax: tableLocator.row.column, where row and column start at 0.

19

storeText (locator, variableName)

Gets the text of an element. This works for any element that contains text.

20

storeTitle (variableName)

Gets the title of the current page.

21

storeValue (locator,variableName)

Gets the (whitespace-trimmed) value of an input field.

22

storeChecked (locator, variableName)

Gets whether a toggle-button (checkbox/radio) is checked.

23

storeElementPresent (locator, variableName)

Verifies that the specified element is somewhere on the page.

24

storeTextPresent (pattern, variableName)

Verifies that the specified text pattern appears somewhere on the rendered page shown to the user.

25

storeVisible (locator, variableName)

Determines if the specified element is visible.

selenium_selenese_commands.htm
Advertisements