🎯
Locator Strategies
ID, CSS, XPath, ARIA role, text, data-testid, and shadow-DOM-piercing locators, from trivial to deliberately brittle.
Medium
Duplicate Classes
Five buttons share one class and no unique attribute — practice `nth-of-type` and structural CSS.
css
Medium
No Unique Attributes
An element with no id, no class, no data-testid — only its text and position identify it.
textxpath
Hard
Regenerating IDs
Every page load, the server mints a fresh random id/class — a hardcoded locator breaks on the very next run.
cssdata-testid
Easy
Unique ID
A button with a stable, unique `id` — the friendliest locator there is.
id