Skip to main content
Browser

Get an element's attribute

Get an element's attribute

Reads and returns the value of an element's HTML attribute on the browser's page. It can give you the inner text, the inner HTML, or any other attribute such as href, class or src.


Options

Select the action

Where the element comes from.

By browser

Reads the element's attribute 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, a#downloadLink for example.

By element

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

Element ID

The action that captured the element whose attribute is read.

By element list

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

Element list ID

The action that captured the source list.

The list index

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

Attribute

Which attribute to read:

  • Common value — a list of the frequent ones (InnerHTML and InnerText)
  • Manual value — type any HTML attribute's name

Attribute name

The exact name of the HTML attribute to read. It appears when Attribute is Manual valuehref, class or data-id, for example.

Returns

Javascript code

js
actions["action-id"].value // the value of the HTML attribute read (Text)

Field selection

  • value — the value of the HTML attribute read from the element (Text)

Rules and conditions

  • Select the action has to be set before the other fields.
  • In By browser mode, Browser or page ID and Element selector are both required.
  • InnerHTML returns the element's inner HTML. InnerText returns only the visible text, with no markup.
  • If the attribute does not exist on the element, the return is empty.