Playwright · Automatic Code Update

Locator healed? Put the fix back into your Playwright test.

Your Playwright test runs again after successful healing? You can optionally save the verified replacement locator in the TypeScript test file so the same change does not need repeated attention.

TypeScriptReviewable FixHealing History
checkout.spec.ts
// TestZombie healed locator
// await page.locator('#checkout-v1').click();
await page.getByTestId('checkout').click();
⚡

Save the run

A suitable locator fix can stop a Playwright test from repeatedly failing because of a simple UI change.

↻

Keep the fix

The successful locator can optionally be written back into the affected test file.

🔎

Keep it traceable

Original locator, replacement and healing context remain visible for review and later analysis.

Heal once. Keep the fix.

Four steps from failure to durable repair.

The code-update flow connects runtime recovery with normal engineering review instead of hiding healing in a black box.

1Playwright locator breaksThe existing locator no longer finds the expected UI element.
2Healing is validatedTestZombie evaluates candidate elements and only uses a sufficiently reliable match.
3Healing is documentedOriginal, replacement and context stay visible in the healing history.
4TypeScript code is updatedOptionally, the successful fix is written into the test file and can go through normal review.
FAQ

Playwright Automatic Code Update FAQ

Does every healing have to be written into code automatically?

No. Automatic Code Update is an optional workflow; teams can combine runtime healing and durable code changes with their own review process.

Does the original locator remain traceable?

The code-update approach is designed for traceability: original locator, healing context and replacement should remain reviewable.

Does code update replace code review?

No. The value is in preparing and documenting repetitive locator repairs while normal quality and review processes can remain in place.

Playwright healing should not end with the current run.

Turn validated healings into durable TypeScript fixes inside the Playwright project you already use.