Stop Letting Browser Agents Improvise Every Click. Use AI to Heal Playwright Instead.
Description and use
A hybrid workflow combines deterministic Playwright scripts with AI agents that intervene only on ambiguous failures, diagnose, propose repairs, validate them, and update the script.
Problem
Automated browser workflows often fail silently or misbehave when UI changes, leading to costly retries and unreliable results.
Outcome
The hybrid pattern reduces costly AI runs to only ambiguous failures, improves reliability, and provides auditability of UI changes.
Workflow
- Schedule job
- Run Playwright happy path
- Validate result and store
- If known failure, retry once with normal recovery
- If unknown failure, capture evidence for AI repair run
- Human approval or sandbox validation
- Update deterministic workflow
Evidence
The agent has spent real money deciding where the same button is, clicked the wrong "continue" three times, and has no useful explanation for why it stopped at 2:17 AM.
Playwright executes the normal path deterministically. The agent wakes up only when the workflow breaks, collects the evidence, diagnoses the failure, proposes a repair, and proves the repaired path in an isolated run.
Use semantic locators first. Prefer getByRole, getByLabel, getByText, and stable data-testid attributes you control.
The repair step earns its place when the failure is ambiguous.
- Record date: 2026-10-22T23:11:04.403Z