76 / 168 · 01 Agent Skills for Browser Automation · Test Patterns for AI-Driven Browser Automation← prev⊞ allnext →☰ Read as one page
11.2Pattern 1: Navigate-Act-Verify (NAV)
The fundamental test pattern. Every browser test follows this structure:
Navigate → Act → Verify
Example: Login Test
# NAVIGATE
playwright-cli open https://app.example.com/login
playwright-cli snapshot
# → textbox "Email" [ref=e3], textbox "Password" [ref=e4], button "Sign in" [ref=e5]
# ACT
playwright-cli fill e3 "user@test.com"
playwright-cli fill e4 "secret123"
playwright-cli click e5
# VERIFY
playwright-cli snapshot
# → Agent checks the YAML: heading "Dashboard" present? PASS
Agent's Role
The agent decides:
- What URL to navigate to
- Which ref to act on (resolved from the snapshot by role and accessible name)
- What text to type
- How to verify success (snapshot contents,
eval "location.href"for URL changes, element presence)