Skip to main content
Browser

Get element

Get element

Finds and returns a single HTML element on the browser's page from a CSS selector. The element it gets is then available as an input to the robot's other actions.

tip

Use the Roberty Automation browser extension to capture an element's CSS selector in one click, without inspecting the HTML by hand.


Options

Select the action

Where to search.

By browser

Finds the element with a CSS selector on the page.

Browser or page ID

The browser, tab or iframe opening action to search in.

Element selector

The CSS selector identifying the element on the page, button#btnConfirm for example.

Element state

The state the element should be in before it comes back: Visible, Invisible/hidden, Present in the DOM or Not present in the DOM. Default: Visible.

Timeout

How long, in seconds, the robot waits for the element to reach that state. Default: 120.

By element

Finds the element inside the scope of a parent element already fetched by a Get element action.

Element ID

The earlier Get element action to use as the search context.

By element list

Gets one particular element from a list captured by a Get elements action.

Element list ID

The Get elements action to use as the source list.

The list index

The element's position in the list. The index starts at 0.

Returns

Javascript code

js
actions["action-id"] // a reference to the HTML element (Element)

Field selection

The element is available in the Element ID field of other actions such as Click, Insert text and everything else that supports By element mode.

Rules and conditions

  • In By browser mode, Browser or page ID and Element selector are both required.
  • In By element mode, Element ID is required, and the element is searched for within the parent's scope.
  • The robot waits for the element to reach the configured state before carrying on. If the timeout is exceeded, the action ends in an error.