Migrating from Playwright
Migration is deliberately boring: Autowright has no step DSL and no runner, so an existing Playwright script keeps its exact shape. Two edits and you’re done.
1. Swap the import
import { chromium } from 'playwright';import { chromium } from '@autowright/browser';@autowright/browser re-exports all Playwright types, so imports like
import type { Page, Locator } from 'playwright' can also move to
@autowright/browser — or stay where they are. Both resolve to the same types.
2. Add the config block
const browser = await chromium.launch({ headless: true, // your existing options, untouched autowright: { scriptId: 'portal-scraper', serviceUrl: 'http://localhost:4400', repoUrl: 'https://github.com/your-org/scrapers', scriptPath: 'src/scraper.ts', },});Everything outside autowright is passed to Playwright exactly as before —
headless, proxy, slowMo, all of it. See
Configuration for every field.
What changes at runtime
On success: nothing. Your script runs, produces the same output, and exits the same way. Capture is a rolling in-memory record; no artifacts are written for clean runs.
On failure: capture, then business as usual. The error is classified, the evidence is bundled and reported, and then the original error is re-thrown. Your try/catch blocks, exit codes, and retry logic all see exactly what plain Playwright would have shown them.
Gotchas
- Pick a stable
scriptIdand keep it. The ID is the anchor for deduplication and artifact paths. Renaming it resets failure history and can double-report an ongoing incident. repoUrlandscriptPathmust be real. The fixer clonesrepoUrland starts reading atscriptPath. If your script lives in a monorepo, the path is repo-relative — not relative to your working directory. Wrong values don’t break the script, but they break the fix.- One
scriptIdper logical script. Two different scripts sharing an ID will have their failures deduplicated against each other. - Local artifacts appear. Failed runs write to
./autowright-artifacts/(configurable). Add it to.gitignore.
Migrating a fleet
Scripts migrate independently — a half-migrated fleet is fine. Wrapped and unwrapped scripts can share a repo; the service only knows about the ones that register. Start with the script that breaks most often.