get_attribute
Read an element's attribute or live property, such as value, href, disabled, checked, or aria-expanded. Waits for the element to exist and returns the value or null.
Instructions
Read an attribute or property of an element, e.g. an input's value, a link's href, or whether it is disabled, checked, or aria-expanded. Waits for the element to exist (it does not need to be visible). Returns the value, or null if it is not set; the live property wins when one exists, so 'value' gives the text currently in an input. Use get_text for visible text, and assert_attribute to check a value as a test step.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Attribute or property name, e.g. 'value', 'href', 'disabled', 'checked', 'class', or 'aria-expanded'. | |
| selector | Yes | How to find the element, e.g. { by: 'css', value: '#login-button' } or { by: 'id', value: 'user-name' }. Prefer id, name, or a short CSS selector. | |
| timeoutMs | No | How long to wait for the element to exist, in milliseconds (default 10000). |