browser-automation-parity

Enforce parity between interactive Browser Subagent sessions and headless Python+Playwright automation in Google Antigravity. Use this skill whenever browser automation fails silently in run mode, a click/navigation/paste works under subagent guidance but breaks in replay, you need CI-grade reproducibility with rich diagnostics, or you're building any Playwright automation that must be observable and self-checking. Also trigger when the user mentions "trace", "flaky test", "missed click", "run mode fails", "subagent works but script doesn't", or wants to debug browser automation discrepancies.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "browser-automation-parity" with this command: npx skills add terryjyu/browser-automation-parity-skill/terryjyu-browser-automation-parity-skill-browser-automation-parity

Browser Automation Parity

Eliminate the gap between Browser Subagent mode (interactive, DOM-level reasoning) and Run mode (headless Python + Playwright) in Google Antigravity.

The core problem: automation that "passes" with subagent guidance silently fails or diverges when replayed as plain Python. This skill makes run mode observable, self-checking, and debuggable at step granularity.

When to Use

  • Automation passes under Browser Subagent but fails (or silently diverges) in Python replay
  • A missed click, paste, or navigation causes wrong results with unclear root cause
  • You need CI-grade reproducibility with rich diagnostics
  • Building any Playwright automation that should be production-grade

Key Principles

1. Every action is a checked contract

A browser action is not "done" until its postcondition is verified. Structure every meaningful interaction as:

precondition → action → postcondition

Postcondition examples: URL changed to expected route, target element became visible, success toast appeared, network request returned expected status, DOM attribute matches expected value.

Never assume a click landed. Always verify the expected state change occurred.

2. Step-level observability is mandatory

For every meaningful step, capture: step name, selector(s) used, timestamps and duration, URL before and after, screenshot on failure (optionally before/after on success), and relevant console logs or network activity.

Emit all step events to a structured JSONL log so failures can be diagnosed without re-running.

3. Playwright tracing for failure forensics

Enable Playwright's Trace Viewer artifacts on failure. Traces include action timeline, DOM snapshots, screencast frames, and network logs — everything needed to diagnose "it worked interactively but not headless."

Use retain-on-failure tracing so passing runs stay lightweight while failures get full diagnostics.

4. Browser Subagent is the debugger, not the executor

The goal is for Python scripts to be the executor. When something fails, the subagent's role is to examine the trace artifacts, screenshots, and step logs, then prescribe fixes to the Python code — not to re-run the workflow interactively.

Implementation

Read the reference files for detailed implementation guidance:

  • references/step-contract.md — The step context manager, precondition/postcondition API, and retry logic. Read this first.
  • references/tracing-setup.md — Playwright tracing configuration, artifact retention, and Trace Viewer integration.
  • references/diagnostics.md — Step log format, failure reports, and how to hand off artifacts to the Browser Subagent for debugging.
  • scripts/step_contract.py — Ready-to-use step contract module. Copy into your project.
  • scripts/example_workflow.py — Example automation using the step contract pattern.

Quick Start

  1. Copy scripts/step_contract.py into your project
  2. Wrap each meaningful browser action in a step() context manager
  3. Add postcondition checks after each action
  4. Enable tracing with retain-on-failure mode
  5. Run your automation — on failure, examine artifacts/steps.jsonl and any .zip traces
from step_contract import step, check, TracingConfig

async def my_workflow(page, artifacts_dir="./artifacts"):
    async with step("login", page, artifacts_dir) as s:
        await page.fill("#email", "user@example.com")
        await page.fill("#password", "secret")
        await page.click("button[type=submit]")
        await check(s, lambda: "dashboard" in page.url, "should navigate to dashboard")

    async with step("create_item", page, artifacts_dir) as s:
        await page.click("[data-testid=new-item]")
        await check(s, lambda: page.locator(".item-form").is_visible(),
                    "item form should appear")

Workflow: Diagnosing a Run Mode Failure

  1. Run the automation — it fails or produces wrong results
  2. Examine steps.jsonl — find the first step with "status": "fail" or unexpected postcondition failure
  3. Open the failure screenshot — see what the page actually looked like
  4. Open the Playwright trace (if enabled) — npx playwright show-trace trace.zip
  5. Hand artifacts to Browser Subagent — ask it to examine the trace/screenshots and suggest code fixes
  6. Apply fixes to the Python script — not to a subagent session
  7. Re-run — verify the fix in headless mode

This keeps the subagent as a diagnostic tool rather than a crutch.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

openclaw-version-monitor

监控 OpenClaw GitHub 版本更新,获取最新版本发布说明,翻译成中文, 并推送到 Telegram 和 Feishu。用于:(1) 定时检查版本更新 (2) 推送版本更新通知 (3) 生成中文版发布说明

Archived SourceRecently Updated
Coding

ask-claude

Delegate a task to Claude Code CLI and immediately report the result back in chat. Supports persistent sessions with full context memory. Safe execution: no data exfiltration, no external calls, file operations confined to workspace. Use when the user asks to run Claude, delegate a coding task, continue a previous Claude session, or any task benefiting from Claude Code's tools (file editing, code analysis, bash, etc.).

Archived SourceRecently Updated
Coding

ai-dating

This skill enables dating and matchmaking workflows. Use it when a user asks to make friends, find a partner, run matchmaking, or provide dating preferences/profile updates. The skill should execute `dating-cli` commands to complete profile setup, task creation/update, match checking, contact reveal, and review.

Archived SourceRecently Updated
Coding

clawhub-rate-limited-publisher

Queue and publish local skills to ClawHub with a strict 5-per-hour cap using the local clawhub CLI and host scheduler.

Archived SourceRecently Updated