83 / 168 · 01 Agent Skills for Browser Automation · Test Patterns for AI-Driven Browser Automation← prev⊞ allnext →☰ Read as one page
11.9Pattern 8: Visual Regression (Screenshot Comparison)
Use screenshots to detect visual changes.
# Capture baseline
playwright-cli goto https://app.example.com/dashboard
playwright-cli screenshot # → path in .playwright-cli/; copy to baseline/
# ... after code change ...
# Capture current
playwright-cli goto https://app.example.com/dashboard
playwright-cli screenshot # → copy to current/
# Agent compares screenshots (via vision or a pixel-diff tool)
Note the disk-first advantage here: screenshots never enter the model context unless the agent chooses to look. A pixel-diff tool can compare hundreds of PNG pairs for zero tokens; the agent only reads the images that actually differ.
Agent's Added Value
With vision capabilities, the agent can:
- Identify specific visual differences
- Classify changes as intentional vs regression
- Describe what changed in natural language