Element condition

Element exists

Returns true if the element exists. To determine this, it attempts to locate the element.

Element has class

Returns true of the element has class class.

Uses WebElement.getAttribute("class") Selenium API to determine the applied classes.

Element is editable

Returns true if the element is editable. To determine this, it looks for the readonly attribute on the element (returning false if true).

Element is enabled

Returns true if the element is enabled.

Uses the WebElement.enabled() Selenium API.

Element is selected

Returns true if element is selected.

Uses the WebElement.isSelected() Selenium API.

Element is visible

Returns true if element is visible.

Uses the WebElement.isDisplayed() Selenium API. Note that this API is frequently unreliable, due to CSS obscuring elements.


Element location

All of these value sources use the WebDriver.findElement() and WebDriver.findElements() APIs.

Each returns a WebElement or list of WebElements (or fails).

Each of these also supports the Find Multiple parameter. When true, the findElements() API will be used instead of the findElement() API. When finding multiple, the step will not fail when none are found - it will return an empty list.

Element by CSS locator

Locates an element using CSS selector using the By.cssSelector() Selenium API.

Element by field name locator

Locates an element with element attribute name = name using the By.name() Selenium API.

Element by id locator

Locates an element with element attribute id = id using the By.id() Selenium API.

Element by link text locator

Locates an element with link text = text using the By.linktext() Selenium API.

Element by XPath locator

Locates an element using XPath xpath using the By.xpath() Selenium API.


Element value

Element text

Returns the text value of the element.

Uses the WebElement.getText() Selenium API.

Element value

Returns the value of the element value attribute.

Uses the WebElement.getAttrivute() Selenium API.

Selected label

Returns the visible label of the selected element option.

Uses the Select.getFirstSelectedOption().getText() Selenium API.


Misc

Keystrokes

Substitutes special keys into a string for use in the Selenium SendKeys steps.

Examples of string expressions:

  • "name1{TAB}name2{TAB}name3"
  • "press this {CONTROL-A} to select all the text"
  • "press {ENTER} to make this two lines"

The available key codes come directly from the Selenium Keys API.

Window Handle

Returns the current window handle.

Uses the WebDriver.getWindowHandle() Selenium API.


Page

Page source

Returns the source of the current page.

Uses the WebDriver.getPageSource() Selenium API.

Page title

Returns the title of the current page.

Uses the WebDriver.getTitle() Selenium API.

Page URL

Returns the URL of the current page.

Uses the WebDriver.getCurrentUrl() Selenium API.