QlarifyLabs
← AI in Testing
Keeping automation healthyEmerging

Locator repair (self-healing)

When a UI test can't find an element because the page changed, find the element by its other attributes and position instead, keep the test running, and propose an updated locator for review.

How it works

UI tests break constantly on harmless changes: a renamed CSS class, a reordered list, a new wrapper element. Self-healing tools, offered in commercial test platforms for several years though with little independent evidence of how well they work, record several attributes for each element when a test passes — text, role, position, neighbours, attributes. When the primary locator fails, they score candidate elements on the page against that fingerprint and use the best match if it's close enough. Newer variants add a model that reads the page and the test step's intent ("click the submit button on the payment form") to choose. Many tools heal at runtime and move on; good practice is to flag every heal and hold the merge until someone has approved the new locator as a code change.

When the test passesrecord a fingerprinttext, role, position, neighboursLocator stops matchingrenamed class, new wrapperScore candidatesagainst the fingerprinta model may read the step’s intentClose enough?if not, the step failsyesUse the best matchrun flagged as healedMerge blockeduntil someone approves
A heal never passes silently: the merge waits until someone approves the new locator. Healing silently is how a test ends up passing on the wrong element.

When to use it

Large UI suites where locator breakage dominates maintenance; products with frequent front-end refactoring; and as a stopgap while the front end adopts stable test IDs.

Limitations

A healed test can pass on the wrong element: if the button moved because the design changed, clicking whatever now looks most similar may hide a real regression. Silent healing turns locator problems into invisible drift. It treats a symptom — the real fix is stable, semantic locators such as roles and test IDs, which reduce the need for healing.

Watch for

A heal that passes on the wrong element: the payment button is missing and the healer clicks “Save draft” instead. Flag every heal and hold the merge until someone has approved the new locator.

Before you reach for it

Find elements by role, label and visible text, with test IDs where those aren’t enough. Then healing only has to cover the parts of the suite not yet converted.

What you still own

Reviewing every healed locator before it becomes permanent, and fixing the underlying locator strategy.

Cite this

Qlarify Labs. (2026). Locator repair (self-healing). Retrieved from https://labs.qlarify.fi/ai-in-testing/locator-repair