Skip to main content
Momentic’s AI reads the DOM, the accessibility tree, and a screenshot of the viewport. Describe elements using any combination of the three.

Accessibility attributes

The accessibility tree is the most reliable signal: reference the element’s accessibility role (e.g. “the submit button”, “the ‘People’ tab”, “the combobox for selecting a month”) along with its accessible name.
Accessibility attributes like aria-role, aria-label, and alt are a testing best practice and improve UX for real users too. Use Chrome DevTools’ accessibility tree to inspect what Momentic sees.

Text content

Reference visible text directly: “the ‘Welcome’ header”, “the text area containing ‘Lorem Ipsum’”. Single-quote text to require an exact match. For example, “the ‘Sign in’ button. don’t allow any typos”.
id, value, type, class, height, width, target, title, href, src, alt, role, headers, scope, checked, required, action, min, max, minlength, maxlength, multiple, pattern, placeholder, accept, contenteditable, data-value, data-testid, data-cy, data-test-id, data-test, data-role, data-type, data-key, data-action, data-hidden, data-handleid, data-handlepos, data-col-index, data-row-index, data-row, data-col

Visual information

The AI is trained on colors, shapes, sizes, and positions: “the red ‘Cancel’ button”, “the thumbs up icon”, “the hamburger menu beside the logo”.
Visual info is limited to the current viewport. DOM and accessibility tree access is not.
Avoid visual-only descriptions for elements smaller than 12x12 pixels or embedded in a row of similar icons.

Positional cues

Use positional cues when multiple elements match the same description.

Absolute

“…at the top of the page”, “…in the bottom right corner”.

Relative

“…below the ‘Introduction’ header”, “…beside the ‘Back’ button”.
  • inside scopes to a parent: “the ‘Submit’ button inside the user dialog”
  • closest picks the nearest match: “the closest ‘Submit’ button to the ‘Username’ input”

Ordering

Use nth for ordered lists: “the second ‘Submit’ button”.
If element order changes between runs, disable caching on that step.