🎁 Get the FREE AI Skills Starter Guide β€” Subscribe β†’
BytesAgainBytesAgain
πŸ¦€ ClawHub

Browser Playwright Bridge

by @swaylq

Run Playwright scripts that reuse OpenClaw browser's login state via CDP with automatic lock-based conflict prevention.

Versionv1.1.0
Installs2
πŸ’‘ Examples

Run a Playwright script (recommended)

./scripts/browser-lock.sh run scripts/my-task.js [args...]
./scripts/browser-lock.sh run --timeout 120 scripts/my-task.js  # custom timeout

Default timeout: 300s. If the script exceeds it, the watchdog kills it and releases the lock.

This automatically: checks lock β†’ stops OpenClaw browser β†’ starts Chrome with CDP β†’ runs script β†’ cleans up β†’ releases lock.

Manual acquire/release

./scripts/browser-lock.sh acquire    # stop OpenClaw browser, start Chrome
node scripts/my-task.js              # run script(s)
./scripts/browser-lock.sh release    # kill Chrome, release lock

Check status

./scripts/browser-lock.sh status

βš™οΈ Configuration

1. Install Playwright in the workspace (once):

cd  && npm install playwright

> Note: npx playwright install is NOT needed. Playwright connects to the existing Chrome via CDP β€” no local browser download required.

2. Copy scripts/browser-lock.sh to your workspace scripts/ directory:

chmod +x scripts/browser-lock.sh

πŸ“‹ Tips & Best Practices

| Problem | Fix | |---------|-----| | Lock held by PID xxx | ./scripts/browser-lock.sh release to force-release | | Playwright connectOverCDP timeout | Ensure OpenClaw browser is stopped first (acquire does this) | | CDP port not found | Chrome isn't running; call browser-lock.sh acquire first | | openclaw browser stop doesn't kill Chrome | Known issue; browser-lock.sh kills the process directly | | Script hangs after completion | Add process.exit(0) at the end | | Login expired | Use OpenClaw browser tool to re-login, then run scripts again |

View on ClawHub
TERMINAL
clawhub install browser-playwright-bridge

πŸ§ͺ Use this skill with your agent

Most visitors already have an agent. Pick your environment, install or copy the workflow, then run the smoke-test prompt above.

πŸ” Can't find the right skill?

Search 60,000+ AI agent skills β€” free, no login needed.

Search Skills β†’