Locator
An object or expression that identifies and represents a specific element on a page for a test to interact with.
What is Locator?
What is Locator?
A locator is how a test refers to an element it wants to act on or assert about. Modern locators favor user-facing, resilient strategies—roles, labels, text, and test ids—over brittle CSS or XPath tied to implementation detail, because resilient locators survive redesigns while fragile ones break constantly. In Playwright, locators are lazy and auto-waiting, resolving to the current element each time they're used. QI generates strong locators when recording and heals them automatically when the page structure changes, keeping tests pointed at the right elements.