Skip to main content
Roberty Studio
RPABrowser

Get Element text

Get Element text

Reads and returns an element's visible text from the browser's page. It works three ways: by CSS selector in the browser, on an element already captured, or on an item from a list of elements.

tip

Use the Roberty Automation browser extension to capture an element's CSS selector in one click.


Options​

Select the action​

Where the element comes from.

An element in the browser​

Reads the element's text using a CSS selector.

Browser or page ID​

The browser, tab or iframe opening action the element is in.

Element selector​

The CSS selector identifying the element on the page, span#total for example.

An element already selected​

Reads the text of an element captured earlier by a Get element action.

Element ID​

The action that captured the element whose text is read.

One item from a selection of multiple elements​

Reads the text of an element from a list captured by a Get elements action.

Elements list id​

The action that captured the source list.

Enter the index of the list​

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

Returns​

Javascript code​

js
actions["action-id"].value // the element's visible text (Text)

Field selection​

  • value — the visible text taken from the element, with no HTML markup (Text)

Rules and conditions​

  • Select the action has to be set before the other fields.
  • In An element in the browser mode, Browser or page ID and Element selector are both required.
  • What comes back is the element's visible content, with no HTML markup.
  • If the element is not found on the page, the action ends in an error.
  • If the element is there but has no text, the return is empty.