# Self-Healing Test Automation in TestOwl

> TestOwl's self-healing selectors automatically detect UI changes and locate the correct element, reducing the manual maintenance needed to keep automated tests running.

Keep your automated tests reliable even when your application evolves and UI changes over time. TestOwl automatically adapts to application changes, reducing test maintenance and keeping your tests running.

## How Self Healing Works

### 1. Run Your Test
Execute your test as usual. No special setup, annotations, or maintenance workflows are required.

### 2. Detect What Changed
If an element moves, is renamed, or its attributes change, TestOwl automatically recognizes that the original locator no longer matches.

### 3. Find the Best Replacement
Instead of failing immediately, TestOwl analyzes multiple signals to locate the correct element.

### 4. Continue Without Breaking
The test proceeds using the updated locator, keeping your automation stable while reducing maintenance and flaky failures.

## What Self-Healing Can and Can't Do

For example, a redesign renames a button's CSS class from btn-primary to btn-main. A script pinned to the old class fails. TestOwl finds the updated button and the test keeps running. Healing is applied automatically, with no approval step.

| What changes | What TestOwl does |
| --- | --- |
| An element's ID or CSS class is renamed | Healed automatically. The test finds the updated element and continues. |
| An element moves or its structure changes | Healed automatically. The test finds the element in its new place. |
| An element's attributes change | Healed automatically. The original locator is replaced for the run. |
| The element is removed from the page | Not healed. The step fails, because there is nothing left to find. |
| An assertion changes (expected text or value) | Not healed. Update the assertion in the test. |

## FAQ

### What is self-healing in test automation?
Self-healing is the ability of a test automation tool to automatically detect when a UI element has changed and locate the correct replacement element, instead of failing the test.

### Does self-healing require any manual setup?
No. Self-healing works automatically during normal test execution. No special setup, annotations, or maintenance workflows are required.

### Does a person need to approve a heal?
No. TestOwl applies the heal automatically while the test runs, so the run continues without a review step.

### What happens if TestOwl cannot find the element?
The step fails. Self-healing repairs a locator when the element still exists in a changed form. If the element has been removed, there is nothing to heal, and the failure points to a real change in the application.

### What can self-healing not fix?
It cannot fix a removed element or a changed assertion. If a page no longer has the element, or the expected text or value has changed, the test needs to be updated.
