Skip to catalogue

semantic locator

Find an element by its role, label, or other user-facing meaning.

Use this when A small markup change breaks many browser tests.

without the term

“Every time we change a CSS class or move a div, a bunch of browser tests break. Can you make the tests find buttons and fields in a way that doesn't break so easily?”

with the term · How do you ask a model for semantic locator?

Replace brittle selectors with semantic locators. Use role and accessible name, check that each match is unique, and rerun the affected tests.

XBlueskyLinkedIn

What is semantic locator?

A semantic locator identifies an interface element through meaning, such as a button’s accessible name, rather than DOM position.

Why does semantic locator matter when vibe coding?

Generated selectors often depend on CSS classes and element order.

How do you do semantic locator?

Use role and accessible name first, scope to the relevant region, and require an unambiguous match.

What goes wrong with semantic locator?

Using the first match hides ambiguous or duplicated controls.

adjacent

reviewed

report a correction