assert_attribute
Verify an element's attribute or property equals, contains, or matches a pattern; waits for the element and fails with expected vs actual.
Instructions
Test step: check that an element's attribute or property equals (default), contains, or matches a regular expression, e.g. that a button is disabled or an input's value is 'standard_user'. Waits for the element to exist; a missing attribute counts as an empty string. Fails as a tool error showing expected vs actual.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | equals = exact match (default); contains = substring; matches = JavaScript regular expression. | equals |
| name | Yes | Attribute or property to check, e.g. 'value', 'disabled', 'href', or 'class'. | |
| expected | Yes | Expected value or pattern, e.g. 'true' for a disabled button. | |
| 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). |