playwright

Browser automation for web testing and interaction. Use for navigating pages, filling forms, clicking elements, taking screenshots, and inspecting page content. Maintains stateful browser session across commands.

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 "playwright" with this command: npx skills add brettatoms/agent-skills/brettatoms-agent-skills-playwright

Playwright Browser Automation Skill

Use playwright-server for browser automation via curl commands. The server maintains a stateful browser session.

Prerequisites

The server is installed at ~/.claude/bin/playwright-server.js. If not present:

cd ~/.claude/bin
npm init -y
npm install playwright
npx playwright install chromium

Server Lifecycle

# Start server (if not running)
curl -sf localhost:3210/health || (node ~/.claude/bin/playwright-server.js &>/dev/null & sleep 1)

# Check health
curl -sf localhost:3210/health

# Stop server
pkill -f playwright-server

Quick Reference

TaskCommand
Start browsercurl -s localhost:3210 -d '{"cmd":"start"}'
Navigatecurl -s localhost:3210 -d '{"cmd":"navigate","url":"URL"}'
Get snapshotcurl -s localhost:3210 -d '{"cmd":"snapshot"}'
Clickcurl -s localhost:3210 -d '{"cmd":"click","selector":"SEL"}'
Fill inputcurl -s localhost:3210 -d '{"cmd":"fill","selector":"SEL","value":"VAL"}'
Screenshotcurl -s localhost:3210 -d '{"cmd":"screenshot"}'
Stop browsercurl -s localhost:3210 -d '{"cmd":"stop"}'

Core Commands

Browser Lifecycle

curl -s localhost:3210 -d '{"cmd":"start"}'              # Headless
curl -s localhost:3210 -d '{"cmd":"start","headless":false}'  # Headed
curl -s localhost:3210 -d '{"cmd":"stop"}'
curl -s localhost:3210 -d '{"cmd":"status"}'

Navigation

curl -s localhost:3210 -d '{"cmd":"navigate","url":"http://localhost:3000"}'
curl -s localhost:3210 -d '{"cmd":"back"}'
curl -s localhost:3210 -d '{"cmd":"reload"}'

Page Inspection

snapshot - Get accessibility tree (use to understand page structure):

curl -s localhost:3210 -d '{"cmd":"snapshot"}'

Example output:

- heading "Page Title" [level=1]
- navigation:
  - link "Home"
  - link "About"
- main:
  - textbox "Email"
  - textbox "Password"
  - button "Sign In"

screenshot - Capture page:

curl -s localhost:3210 -d '{"cmd":"screenshot"}'
curl -s localhost:3210 -d '{"cmd":"screenshot","path":"/tmp/shot.png"}'
curl -s localhost:3210 -d '{"cmd":"screenshot","fullPage":true}'

Basic Interactions

curl -s localhost:3210 -d '{"cmd":"click","selector":"button[type=submit]"}'
curl -s localhost:3210 -d '{"cmd":"fill","selector":"input[name=email]","value":"test@example.com"}'
curl -s localhost:3210 -d '{"cmd":"type","selector":"input","text":"query"}'
curl -s localhost:3210 -d '{"cmd":"press","key":"Enter"}'

Waiting

curl -s localhost:3210 -d '{"cmd":"wait","selector":".loaded"}'
curl -s localhost:3210 -d '{"cmd":"wait","selector":".spinner","state":"hidden"}'
curl -s localhost:3210 -d '{"cmd":"waitUrl","pattern":"**/dashboard"}'
curl -s localhost:3210 -d '{"cmd":"waitLoad","state":"networkidle"}'

Selector Basics

# CSS selectors
"button[type=submit]"
"#login-form input[name=email]"

# Text selectors
"text=Sign In"

# Role selectors
"role=button[name='Sign In']"

# Combining
"#form >> input[name=email]"

For complete selector strategies: See references/selectors.md

Additional References

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

code-symbols

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

github

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

code-search

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

playwright

No summary provided by upstream source.

Repository SourceNeeds Review