mcpField
A
agent-browser-visual

agent-browser-visual

github.com/owenleezyTesting & quality456 installsUpdated 31w ago
Repository

About agent-browser-visual

agent-browser-visual is an execution guide for visual testing with agent-browser. It helps teams compare screenshots and DOM snapshots, record browser flows, and capture network traces with guidance to avoid common errors.

Key features

  1. 01Screenshot comparison with baselines
  2. 02URL and DOM snapshot diffs
  3. 03Browser flow video recording
  4. 04Annotated screenshot capture
  5. 05HAR network trace recording

Use cases

  1. 01Check for visual regressions after deployment
  2. 02Compare staging and production pages
  3. 03Document a bug with annotated images or video
  4. 04Investigate page performance and API requests

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/owenleezy/agent-browser-skill --skill agent-browser-visual

After installing, type/agent-browser-visualin Claude Code to confirm it loaded.

Details

From the project README

Visual Evidence & Regression — Execution Protocol

Internal template. Entry point: agent-browser skill.


NEVER

NEVER compare screenshots before `wait --load networkidle` — animation frames cause false diffs
NEVER use default diff threshold for pixel-perfect checks — set --threshold 0.05 or lower
NEVER skip baseline update after intentional UI changes — stale baseline = false positives forever
NEVER start `network har start` after navigation — HAR must begin before the requests you want to capture
NEVER start `record start` before opening the page — start after `open` + `wait` to preserve auth state

Use Case Decision Tree

GoalCommand
Catch visual regression (before/after deploy)diff screenshot --baseline
Compare staging vs production side by sidediff url
Detect DOM structure changesdiff snapshot
Create shareable demo / bug report videorecord start → actions → record stop
Annotated screenshot for docs / ticketscreenshot --annotate
Capture full network trace for perf/debugnetwork har start → actions → network har stop

Visual Regression Workflow

# Step 1: Capture baseline (run once before changes)
agent-browser open <url>
agent-browser wait --load networkidle
agent-browser screenshot --full baseline.png

# Step 2: After changes, compare
agent-browser open <url>
agent-browser wait --load networkidle
agent-browser diff screenshot --baseline baseline.png --output diff.png --threshold 0.1

# Step 3: Scope to specific element (reduces noise from unrelated areas)
agent-browser diff screenshot --baseline baseline.png -s "#main-content"

# Step 4: Compare two environments (snapshot + optionally screenshots)
agent-browser diff url https://staging.example.com https://prod.example.com
agent-browser diff url https://staging.example.com https://prod.example.com --screenshot --full

Threshold guide:

  • 0.1 (default) — tolerates antialiasing, minor rendering differences
  • 0.05 — catches subtle color/font changes
  • 0.01 — pixel-perfect (sensitive to any rendering difference)
  • 0.2 — forgiving mode for dynamic content areas

Video Recording Workflow

# Best practice: open page first, then start recording (preserves auth state)
agent-browser open <url>
agent-browser wait --load networkidle
agent-browser snapshot -i            # explore first, plan your actions
agent-browser record start ./demo.webm
# ... perform actions ...
agent-browser record stop

# Record from a fresh URL
agent-browser record start ./onboarding.webm https://app.example.com/signup

# Restart (stop current recording, start new — useful for retakes)
agent-browser record restart ./take2.webm

To convert WebM → GIF: ffmpeg -i demo.webm -vf "fps=10,scale=800:-1:flags=lanczos" demo.gif


Annotated Screenshot

agent-browser screenshot --annotate step1.png

Output: screenshot with numbered labels overlaid + a legend mapping each number to its element name.

Ideal for: bug reports, documentation, sharing context with non-technical reviewers. The annotation labels survive screenshot compression better than cursor overlays.


HAR Recording (full network trace)

# Must start BEFORE navigation to capture all requests
agent-browser network har start ./trace.har
agent-browser open <url>
agent-browser wait --load networkidle
# ... perform actions you want to trace ...
agent-browser network har stop

# View: open in browser DevTools → Network tab → Import HAR
# Or: https://har.tech (online analyzer)

Use when: diagnosing slow pages, verifying API calls, auditing third-party requests.


DOM Snapshot Diff

# Compare current DOM vs last snapshot in this session
agent-browser diff snapshot

# Compare against a saved snapshot file
agent-browser diff snapshot --baseline before.txt

# Scope to a specific section
agent-browser diff snapshot -s ".sidebar" -c

# Combined: compact + depth-limited scope
agent-browser diff snapshot -s "#app" -c -d 4

Use when: verifying a code change didn't silently alter DOM structure, or checking that a UI component renders identically across environments.


Recovery Patterns

FailureRecovery
Diff always shows changes (animation/loading)wait --load networkidle + add wait 500 for CSS transitions
Diff too sensitive (antialiasing noise)Increase --threshold 0.2
Diff misses real regressionDecrease --threshold 0.05
Video file too largeScope recording to shorter flow; use screenshot --full for static evidence
HAR missing early requestsRestart: network har start must be called before open
record loses auth stateAlways open + wait first, then record start (no URL arg)

Pitfalls

MistakeFix
Screenshot before page is stablewait --load networkidle before any capture
Baseline not updated after intentional design changeDelete old baseline, re-capture: screenshot --full baseline.png
diff screenshot without --baseline--baseline <file> is required
HAR started after XHR calls already firednetwork har start must come before open or reload
record start before page open loses authOpen page + wait first, then start recording

Comments

Markdown supported