Playwright skill

From jackspace/ClaudeSkillz · View interactive version

Playwright skill is an AI agent skill from the GitHub repository jackspace/ClaudeSkillz. Persistent browser automation via Playwright daemon. Keep a browser window open and send it commands (navigate, execute JS, inspect console). Perfect for interactive debugging, development, and testing web applications. Use when you need to interact with a browser repeatedly without opening/closing

How to use this skill

Skill file

Browser Daemon - Persistent Browser Automation

Persistent browser daemon that keeps Chrome open and accepts commands via file-based IPC.

Quick Start

Start the daemon (once per session)

cd ~/.claude/skills/playwright-skill
node browser-daemon.js

Or ask: "Start the browser daemon in the background"

The browser window opens and stays open.

Send commands

Use absolute paths (cleaner, no directory changes):

# Navigate
~/.claude/skills/playwright-skill/browser-client.js navigate "http://localhost:8080/..."

# Execute JavaScript
~/.claude/skills/playwright-skill/browser-client.js exec "document.title"
~/.claude/skills/playwright-skill/browser-client.js exec "document.querySelectorAll('div').length"

# Console logs
~/.claude/skills/playwright-skill/browser-client.js console
~/.claude/skills/playwright-skill/browser-client.js console-clear

# Status
~/.claude/skills/playwright-skill/browser-client.js status

# Resize viewport
~/.claude/skills/playwright-skill/browser-client.js resize 1920 1080

Both scripts have shebangs and are executable, so they can be called directly.

Architecture

Claude (Bash tool)
    ↓
browser-client.js (writes .browser-command)
    ↓
browser-daemon.js (polls, executes, writes .browser-result)
    ↓
Chrome Browser (Playwright-controlled)

IPC Files:

Files created/deleted automatically during operation.

Commands

navigate

Navigate to URL and wait for page load.

node browser-client.js navigate "http://localhost:8080/page"

Returns: { success: true, url: string, title: string }

exec

Execute JavaScript in browser context.

node browser-client.js exec "document.querySelectorAll('div').length"

Returns: { success: true, result: any }

console

Get all captured console logs.

node browser-client.js console

Returns: { success: true, logs: [{ type, text, location }] }

console-clear

Clear console log buffer.

node browser-client.js console-clear

Returns: { success: true }

status

Check daemon status and current page info.

node browser-client.js status

Returns: { success: true, url, title, consoleLogsCount }

resize

Resize browser viewport.

node browser-client.js resize 1920 1080

Returns: { success: true, width, height }

Daemon Behavior

Browser Configuration

chromium.launch({
  channel: 'chrome',      // Use Google Chrome, not Chromium
  headless: false,        // Visible window
  args: ['--start-maximized']
})

Important Quirks

Manual window resizing does NOT work:

DevTools overlay:

Viewport vs Window:

Use Cases

Interactive development: Keep browser open while testing changes, reload and check console without manual interaction.

Debugging console logs: Track down log sources with automatic source location capture.

Inspecting page state: Query DOM, check element counts, inspect computed styles via JavaScript execution.

Testing workflows: Automate multi-step browser interactions (navigate, fill forms, submit, check results).

Troubleshooting

Daemon not responding:

ls ~/.claude/skills/playwright-skill/.browser-ready
cd ~/.claude/skills/playwright-skill && node browser-daemon.js

Commands timing out:

Browser window closed:

Setup (First Time)

cd ~/.claude/skills/playwright-skill
npm install

This installs Playwright and downloads Chrome browser.

Advanced Capabilities

See META_COMMANDS.md for comprehensive reference of Playwright's meta-level capabilities beyond basic testing:

Integration Notes

When user requests browser interaction:

  1. Check if daemon is running (.browser-ready file exists)
  2. If not, offer to start as background task
  3. Use browser-client.js commands to perform actions
  4. Report results back to user

User can request additional features - the codebase is straightforward and well-documented for extensions.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.