Skip to content

Debugging Failures

When a fix comes back as needs attention — or you just want to see what happened yourself — everything the fixer saw is available to you too.

Start local

Every failure writes artifacts to local disk before any upload is attempted (default ./autowright-artifacts/, configurable via localArtifactDir). If storage or the service was down, this directory is your complete record.

What’s in the evidence

FileUse it to
screenshot-*.pngSee the page as it looked in the last 3 moments before failure
dom.htmlSearch for the selector that failed — and what replaced it
network.jsonSpot failed requests, redirects to login pages, 429s
console.jsonCatch JS errors the page threw before your action failed
actions.jsonReplay the run: every action, its arguments, and duration
browser-state.jsonCheck context state at failure time
trace.zipOpen in Playwright’s trace viewer (only if tracing was enabled)

Read the action log first

actions.json is the fastest orientation: scan to the last entry — that’s the failing action, with its selector, arguments, duration, and the error. Then open dom.html and search for that selector. Nine times out of ten the story is right there: the element is gone, renamed, or behind a new overlay.

Use the dashboard

The dashboard’s fix detail page assembles the same investigation for you: classification, failed step, page URL, error message, the agent’s summary of what it found, files it changed, and a link to the artifact bundle. For a needs-attention outcome, the agent’s summary usually names exactly what a human needs to decide.

When to enable tracing

autowright: {
scriptId: 'portal-scraper',
capture: { tracing: true },
}

Traces are the heaviest artifact, so they’re off by default. Turn them on when screenshots and the DOM aren’t enough — timing-sensitive failures, races with dynamic content, or anything where you need to scrub through the run step-by-step in Playwright’s trace viewer.

Manual snapshots mid-script

For diagnostics at a point of your choosing — not just at failure — grab the observer:

import { chromium, getObserver } from '@autowright/browser';
const page = await browser.newPage();
const observer = getObserver(page);
await page.goto('https://portal.example.com');
// suspicious state? capture it now, while things still "work"
await observer.captureSnapshot();

This is useful for intermittent failures: snapshot at checkpoints on every run, and when the failure finally happens you have the healthy runs to diff against.