Skip to main content

Get details of element on web page

Sophie avatar
Written by Sophie
Updated over 2 weeks ago

Definition and Usage

This command extracts the value of a specific attribute from an element on a web page. It allows you to retrieve various properties such as text content, source code, element value, URLs, coordinates, or any other HTML attribute from web elements.


Parameter Values

Input parameters

Parameter

Description

Possible Values

Required

Options / Notes

Web page

Select a variable that contains the web page to work with

Any web page variable

Yes

Must be a valid web page object

Element

Select or capture an element to operate on

Any web element

Yes

Use the Capture button to select an element directly from the web page

Select attribute

Select the element attribute to extract from the web page

Text content, Source code, Value, Link/URL, Other attributes, Coordinates, Inner text

Yes

If "Other attributes" is selected, you must specify the attribute name

Relative to

Relative to the entire screen or browser page

Top left corner of screen, Top left corner of web page

No

Only applicable when "Coordinates" is selected

Attribute name

Enter attribute name of the web element

Any valid HTML attribute name

No

Required only when "Other attributes" is selected

Store element attribute into

Store the attribute into a new variable

Any valid variable name

Yes

The output variable will contain the extracted attribute value

Advanced settings

Parameter

Description

Possible Values

Required

Options / Notes

Element timeout (s)

Wait time for element to appear (seconds)

Numeric value

No

Default is 20 seconds

Error handling

Parameter Name

Description

Throw error & stop

When an error occurs, the action will trigger an error and stop the execution of the entire app.

Retry command

If an error occurs, the action will retry the command in an attempt to resolve the issue and continue the process.

Ignore error & continue

When an error occurs, the action will be ignored, and the workflow will continue without interruption.

Variables produced

This action produces a variable containing the extracted attribute value from the specified web element. The type of the value depends on the selected attribute (text, URL, coordinates, etc.).


Using Variables in Conditions

You can use the variable produced by this command in subsequent actions or conditions by referencing it with the {variableName} syntax. For example, if you store the extracted text into a variable named "webElementAttribute", you can use {webElementAttribute} in conditions to make decisions based on the element's content.


Notes

  • Before using this command, ensure that the web page is properly loaded and the target element exists on the page.

  • The element timeout parameter determines how long the system will wait for the element to appear before reporting an error.

  • For dynamic web pages, you may need to increase the element timeout value if elements load slowly.

  • When selecting "Coordinates", you can choose whether the coordinates should be relative to the screen or the web page.

  • For extracting specific HTML attributes (like "id", "class", "data-*"), select "Other attributes" and specify the attribute name.

Did this answer your question?