Locators That Survive a Redesign: A Selector Strategy for UI Automation
UI automation fails from brittle locators far more often than from real bugs. A first-person take: selector priority (role/label → data-testid → text → CSS → XPath last), why positional XPath and auto-generated classes are time bombs, how to agree on data-testid with developers, the dynamic-content and i18n traps, and how it maps across Playwright, Selenium, Cypress, and Appium. With a good-locator checklist and a list of anti-patterns.