Skip to main content
Browser

Get an HTML attribute

Get an HTML attribute

Reads and returns the value of one particular HTML attribute of an element on the browser's page, with the attribute's name given by hand. Useful for pulling out href, src, class, data-id and the like.


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, img.logo 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

The exact name of the HTML attribute to read from the element — src, href 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.
  • Attribute takes any standard HTML attribute: href, src, class, name, id and data-*.
  • If the attribute does not exist on the element, the return is empty.