How selector healing works
After you record a flow, the DOM will change. Healing tries to find the same intent with a new locator before failing the run — fewer false reds on preview deploys.
On each step, TestForge first checks whether the original selector still matches. If not, the repair engine walks through strategies in order, scores confidence, and either continues with a repaired selector or surfaces a clear failure with context for a quick manual fix.
Strategies (high level)
role + accessible name
Finds elements by ARIA role and visible or accessible label.
text content
Matches stable user-visible copy when classes change.
aria-label / placeholder
Uses explicit labels on inputs and icon buttons.
data-testid
Prefers stable test hooks when your app provides them.
structural fallbacks
nth-child and fuzzy class matching when nothing else resolves.
Best practice
Add data-testid on critical interactive elements in your Next.js app. Healing works better when at least one stable anchor exists in the hierarchy.