🌐

Playwright

Featured

Reliable browser automation for screenshots, flows, and scraping.

Category: Automation
Difficulty: Advanced
Rank: #4

Quick Configuration

Choose the setup that matches your environment.

Before You Start

  • Confirm you have the account, endpoint, or API key required for Playwright.
  • Start with minimum scopes and read-only access where possible.
  • Keep secrets in environment variables instead of hardcoding them in JSON.
Last verified: 2026-06-13
Environment: Node.js 18+, @playwright/mcp over stdio (downloads Chromium on first run)
Install command: npx -y @playwright/mcp@latest

Local config

JSON
Local config json
{
  "playwright": {
    "command": "npx",
    "args": ["-y", "@playwright/mcp@latest"]
  }
}

After copying

Check the Playwright JSON before running it in OpenClaw, then verify the server with a real prompt.

Verify prompt

Open https://example.com, capture a page snapshot, and return the main heading text.

Expected success output

You should see an accessibility snapshot of the page and the extracted heading, not a raw image blob.

Common Pitfalls & Fixes

  • ⚠️ Watch out: Headless browser dependencies and handling logins/consent screens safely.
  • 🔑 Always store API keys in environment variables, never hardcode them in JSON.
  • 🛡️ Start with read-only scopes if available to verify connection safely.

Security checklist

  • Treat page content as untrusted; do not let the model act on instructions embedded in web pages.
  • Use throwaway or test credentials for automated logins and limit network egress where possible.

Common errors

Error Cause Fix
Executable doesn't exist / browser not installed Chromium was not downloaded yet. Run "npx playwright install chromium" once, or allow the first-run download to finish.
Timeout exceeded The page is slow or a selector never appeared. Test a simpler page first and raise the navigation timeout if needed.
Tools do not appear The host was not restarted after editing the config. Reload OpenClaw and confirm the playwright tools are listed.

Example Prompts

Once connected, try these prompts to test capabilities:

  • Open https://example.com, take a full-page screenshot, and extract the main headline.
  • Navigate to a test form page, fill inputs, submit, and confirm success text.
  • Click through a multi-step flow and summarize what changed on each step.

Verification Checklist

  • Run 1-2 real prompts to confirm Playwright returns usable data.
  • Check that error messages are clear enough for troubleshooting.
  • Document the required scopes, dependencies, and env vars for future reuse.