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
Test Forward 2027 ยท Software Quality in the age of AI image
Tue, 19 Jan 2027
Test Forward is one afternoon at Station F with the QA and engineering people closing that gap in their own teams.
MoT Advanced Certificate in Test Automation image
Ascend to leadership roles by mastering strategic skills in automation strategy creation, planning and execution
This Week in Quality image
Debrief the week in Quality via a community radio show hosted by Simon Tomes and members of the community
Subscribe to our newsletter