Skip to content
← Back to work

Autowright

Self-healing Playwright · 12 error categories · 24 scenarios

12 error categories
24 validated scenarios
38+ fixer unit tests
4 AI-generated PRs

A system that makes Playwright browser automation scripts self-healing. When a script fails — a selector changed, a page restructured, credentials expired, a network request timed out — Autowright captures the full context of the failure, diagnoses the root cause using AI, fixes the code, and opens a pull request. No human intervention required.

The developer changes one import line. Everything else is invisible.

// Before
import { chromium } from 'playwright';

// After — one line changes, everything else stays the same
import { chromium } from '@autowright/browser';

Transparent proxy layer

Autowright uses JavaScript Proxy objects at three levels — Browser, Context, and Page. Every method call passes through transparently. The developer writes normal Playwright code. The Proxy intercepts every action, records timing, captures rolling screenshots (last 3), logs all network requests/responses, and monitors console output.

When an error occurs, the Proxy bundles everything into a .tar.gz artifact: DOM snapshot, screenshots, network log, console log, action trace with timing, and browser diagnostics (CPU, memory, OS).

Security

Passwords are redacted at capture time. Any fill() call on password fields or selectors containing ‘password’, ‘secret’, ‘token’, ‘key’, or ‘credential’ has its value replaced with [REDACTED] before it enters the action log. Plain text credentials never exist in the artifact, even briefly.

Error classification

12 categories: SELECTOR_NOT_FOUND, SELECTOR_TIMEOUT, NAVIGATION_FAILED, NETWORK_TIMEOUT, NETWORK_ERROR, CREDENTIALS_INVALID, DATA_VALIDATION, BROWSER_CRASH, BROWSER_CLOSED, PERMISSION_DENIED, RUNTIME_ERROR, UNKNOWN. Each classification drives the service’s behaviour — whether to queue for fixing, notify, or block.

Coordination service

An Express server that registers scripts, deduplicates errors by hash (same failure doesn’t generate duplicate fix attempts), tracks failure counts per script, and auto-blocks scripts after 3 consecutive failures. The fixer polls this service for pending work.

AI fixer

Powered by Claude Agent SDK (claude-sonnet-4-6) with built-in tools: Read, Edit, Bash, Glob, Grep, plus vision for reading screenshots. The fixer downloads the artifact bundle, clones the repo, creates a fix branch, and gives Claude the full failure context — DOM, screenshots, network logs, source code, and action trace. Claude reads everything, diagnoses the root cause, edits the code, and the fixer commits, pushes, and opens a GitHub PR with Slack notification.

Real-world validation

Tested iteratively against books.toscrape.com with intentionally broken selectors. Claude fixed all 4 rounds of bugs, including proactively fixing selectors it hadn’t hit yet. Then tested against the live Arive mortgage scraper — Claude correctly diagnosed: “HTTP 401 — the password for the Auth0 tenant is expired. The ARIVE_PASSWORD environment variable needs to be updated.”

Next project

CodeTeleport

Claude Code session sync · MCP server + CLI