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.
npx -y @playwright/mcp@latestLocal 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
Browser install
If Playwright MCP starts but cannot open a browser, run npx playwright install chromium and confirm OpenClaw is using the same Node environment.
Headless mode
Some sites behave differently in headless mode. Verify with a simple public page first, then adjust headless settings or user-agent only if needed.
Timeouts
timeout exceeded usually means the page is slow or the selector never appeared. Check network and page availability before increasing navigation timeouts.
| 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.
FAQ
What if Chromium is not installed?
Run "npx playwright install chromium" once, or allow the first-run download to finish.
What should I know about headless mode?
Some sites behave differently in headless mode. Test with a simpler page first, and adjust user-agent or disable headless for debugging if needed.
How do I fix timeout exceeded errors?
The page may be slow or a selector never appeared. Test a simpler page first and raise the navigation timeout if needed.