Use Playwright Agent CLI to open a browser, visually verify your work, check for crashes, and confirm features behave correctly. Use whenever the user asks or a task expects you to confirm the feature in the UI or you need to manipulate the browser.
Use the playwright-cli agent CLI (@playwright/cli) to open the app in a real browser and verify your work looks right, doesn't crash, and behaves as expected.
$ARGUMENTS — a URL, page path, or brief description of what to check. Defaults to http://localhost:3000 if empty.
# Session
playwright-cli open <url> # Open browser at URL
playwright-cli open --headed <url> # Headed (visible) mode
playwright-cli close # Close current page
playwright-cli close-all # Close all sessions
# Navigate
playwright-cli goto <url>
playwright-cli reload
playwright-cli go-back
# Interact
playwright-cli click <ref> # Click element by ref
playwright-cli fill <ref> "text" # Fill input field
playwright-cli type "text" # Type into focused element
playwright-cli select <ref> "value" # Select dropdown option
playwright-cli press Enter # Press a key
playwright-cli hover <ref>
# Inspect
playwright-cli snapshot # Page structure as YAML (token-efficient)
playwright-cli screenshot # Capture screenshot
playwright-cli screenshot --filename=check.png
playwright-cli console # Show console messages (errors, warnings)
playwright-cli network # Show network requests
playwright-cli eval "document.title" # Run JS on page
# Tabs
playwright-cli tab-list
playwright-cli tab-new <url>
playwright-cli tab-select <index>
This is the typical flow after finishing a feature or fix:
Open the page
playwright-cli open --headed http://localhost:3000
Capture a snapshot to understand page structure
playwright-cli snapshot
Check for console errors
playwright-cli console error
Take a screenshot to visually confirm layout
playwright-cli screenshot --filename=visual-check.png
Interact with the feature (click buttons, fill forms, etc.)
playwright-cli click "Submit"
playwright-cli fill "Search" "housing assistance"
Verify the result — snapshot or screenshot after interaction
playwright-cli snapshot
playwright-cli console error
Clean up
playwright-cli close-all
snapshot returns a YAML representation of the page — much cheaper than a full screenshot when you just need structure.console error after page load to catch runtime crashes.network to verify API calls fired correctly.click <ref>) come from snapshot output — run snapshot first, then use the refs it gives you.