Two MoTacon attendees are on the left. The MoTaacon logo is in the center, and to the right a prompt to Get Your Ticket.

Locator strategy

Locator strategy image
The approach a test automation engineer uses to identify and target UI elements within an application during automated test execution. A locator strategy defines which selector types to use (such as IDs, CSS selectors, ARIA roles, or data attributes) and how to prioritise them for reliability and maintainability. User-facing selectors (those tied to visible labels or roles rather than internal DOM structure) are generally preferred because they are more stable across UI changes and better reflect real user behaviour. AI tools can suggest locators automatically, but the tester or engineer should review these, as AI often defaults to convenient selectors rather than the most robust ones. 

For example, using a visible button label as a selector is typically more resilient than using a dynamically generated class name.
Explore MoT
Influence, from the other side of the table image
What I learned about influence by becoming a stakeholder
MoT Foundation Certificate in Test Automation image
Unlock the essential skills to transition into Test Automation through interactive, community-driven learning, backed by industry expertise
Into The Motaverse image
Into the MoTaverse is a podcast by Ministry of Testing, hosted by Rosie Sherry, exploring the people, insights, and systems shaping quality in modern software teams.
Subscribe to our newsletter