> ## Documentation Index
> Fetch the complete documentation index at: https://momentic.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# checkElementAttribute

> Element-level assertion family for an HTML attribute on the element.

Asserts a condition on an HTML attribute on the element. Each alias is its own
single-key command. There is no separate `condition` or `negated` field. The
positive and negative variants map directly to the table below.

## Parameters

| Parameter | Type                 | Required | Description                                                                                            |
| --------- | -------------------- | -------- | ------------------------------------------------------------------------------------------------------ |
| `element` | `string`             | No       | Natural-language description of the target. Use exactly one of `element`, `css`, `coords`, or `x`/`y`. |
| `css`     | `string`             | No       | CSS selector for the target. Use instead of the description key.                                       |
| `coords`  | `string \| { x, y }` | No       | Absolute viewport coordinates. Either an `x, y` string (e.g. `120, 40`) or a `{ x, y }` object.        |
| `x`       | `number \| string`   | No       | X coordinate. Must be provided together with `y`.                                                      |
| `y`       | `number \| string`   | No       | Y coordinate. Must be provided together with `x`.                                                      |
| `force`   | `boolean`            | No       | Force the action even when the element is not actionable.                                              |
| `iframe`  | `string`             | No       | URL or URL pattern of the iframe that contains the target element.                                     |
| `timeout` | `number`             | No       | Maximum time in milliseconds to wait for the condition to hold.                                        |
| `name`    | `string`             | Yes      | Attribute name (for attribute checks) or CSS property name (for style checks).                         |
| `value`   | `string`             | Yes      | Value to compare against. Required for every condition except `*Exists` and `*DoesNotExist`.           |
| `saveAs`  | `string`             | No       | Name of the variable to write this step's return value to.                                             |
| `retries` | `number`             | No       | Number of times to retry the step on failure before failing the test.                                  |
| `skipped` | `boolean`            | No       | Skip this step at execution time.                                                                      |

## Examples

```yaml theme={null}
- checkElementAttributeEquals:
    element: the badge
    name: data-slot # the attribute to read
    value: badge # the value it must equal
```

```yaml theme={null}
- checkElementAttributeEquals:
    element: username input
    name: value
    value: jeff@retool.com
```

```yaml theme={null}
- checkElementAttributeStartsWith:
    element: Soulèvement intégraliste link
    DANGEROUS_FORCE_DYNAMIC: true
    name: title
    value: Soulèvement # matches when the title starts with this
```

```yaml theme={null}
- checkElementAttributeDoesNotExist:
    element: the 'badge' badge
    name: non-existent
```

## Notes

Aliases supported by this family:

| Alias                                   |
| --------------------------------------- |
| `checkElementAttributeExists`           |
| `checkElementAttributeDoesNotExist`     |
| `checkElementAttributeContains`         |
| `checkElementAttributeDoesNotContain`   |
| `checkElementAttributeEquals`           |
| `checkElementAttributeDoesNotEqual`     |
| `checkElementAttributeStartsWith`       |
| `checkElementAttributeDoesNotStartWith` |

## Related

* [Writing assertions](/core-concepts/writing-assertions)
* [Finding elements](/core-concepts/finding-elements)
* [Test format](/core-concepts/test-format)
