Get Attribute
Get Attribute
Section titled “Get Attribute”Type: page-get-attribute · Package: Browser v1.0.0 · Output: string
Reads the value of an element’s HTML attribute. It is used to extract data that is not visible text: the download link of a button (href), the URL of an image (src), a hidden identifier (data-id), or the state of an element (class, disabled).
How it works
Section titled “How it works”Locate the element by its selector and return the value of the attribute whose name you indicate in attribute. If the attribute does not exist, it returns empty.
Required parameters
Section titled “Required parameters”| Parameter | Editor | Description |
|---|---|---|
selector | selector | The element to read the attribute from. |
attribute | text | Nombre del atributo HTML. Ej: href, src, data-id, class. |
Optional parameters
Section titled “Optional parameters”| Parameter | Editor | Description |
|---|---|---|
page | session | The page session. Omit it inside a body; outside, pass = page. |
timeout | number | Maximum ms to wait for the element. By default 30000. |
Output
Section titled “Output”Returns a string with the attribute value.
Example
Section titled “Example”Get the download link for a document:
Page Get Attribute selector = (#enlaceFactura) attribute = "href" → output: urlPdfLog message = = "URL del PDF: " + urlPdf