Q2 of 21 · AI for testing
What is a self-healing selector in AI-powered test automation?
Short answer
Short answer: A self-healing selector uses AI to recover a broken locator at runtime — when the original selector fails, it searches the DOM using fallback strategies (nearby text, ARIA label, role, visual position) and updates the stored selector to one that works.
Detail
Traditional automation fails with 'element not found' the moment a developer renames a CSS class. Self-healing tools attempt to find the element using ranked fallback locators, re-run the test, and log the old and new selectors for a human to confirm.
The benefit: fewer broken tests from routine front-end refactors. The limits: self-healing works for minor DOM changes (attribute rename, class change) but cannot handle a flow change — if the button has been removed or the step restructured, no selector recovery can save the test. Unreviewed healed selectors also create drift: the codebase no longer reflects what a human intentionally wrote.
Self-healing is a maintenance aid, not an architecture. Well-chosen stable locators — semantic roles, data-testid attributes — are still the foundation.