Stable Browser
by @jarvis563
Set up reliable browser automation using Chrome DevTools Protocol (CDP) instead of the flaky browser extension relay. Use when browser relay keeps disconnect...
clawhub install stable-browserπ About This Skill
name: stable-browser description: Set up reliable browser automation using Chrome DevTools Protocol (CDP) instead of the flaky browser extension relay. Use when browser relay keeps disconnecting, throwing WebSocket 403 errors, or when you need stable headless/headed browser control for web scraping, form filling, social media posting, or any browser automation task. Replaces profile="chrome" with a rock-solid CDP connection.
Stable Browser
Replace the unreliable browser extension relay with a direct Chrome DevTools Protocol connection.
The Problem
The OpenClaw browser extension relay (profile="chrome") frequently breaks:
The Fix: Chrome CDP
Launch Chrome with a debug port and connect directly. No extension needed.
Quick Setup
Run the setup script to configure everything:
bash scripts/setup-cdp.sh
This will:
1. Create a dedicated Chrome profile at ~/.chrome-debug-profile
2. Add browser.cdpUrl to your OpenClaw config
3. Create a LaunchAgent (macOS) so Chrome starts on login
4. Verify the connection works
Manual Setup
If you prefer to set things up manually, see references/manual-setup.md.
Usage
After setup, always use profile="openclaw" (not profile="chrome"):
browser(action="snapshot", profile="openclaw")
browser(action="navigate", profile="openclaw", targetUrl="https://example.com")
browser(action="screenshot", profile="openclaw")
Key Differences from Extension Relay
| Feature | Extension Relay | CDP Direct |
|---------|----------------|------------|
| Stability | Frequent disconnects | Rock solid |
| Setup | Install extension + attach tab | One-time script |
| Auth/Cookies | Shares your main Chrome | Dedicated profile |
| Speed | Extra hop through extension | Direct protocol |
| Headless | No | Optional (--headless=new) |
Dedicated Profile
The CDP browser uses ~/.chrome-debug-profile β a separate Chrome profile. This means:
Tips
targetId to pin a specific tab--headless=new to the launch command for invisible operationpkill -f 'remote-debugging-port=9222' && sleep 1 && bash scripts/setup-cdp.shTroubleshooting
setup-cdp.sh or launch manuallylsof -i :9222pkill -f chrome-debug-profile~/.chrome-debug-profile and re-run setupπ‘ Examples
After setup, always use profile="openclaw" (not profile="chrome"):
browser(action="snapshot", profile="openclaw")
browser(action="navigate", profile="openclaw", targetUrl="https://example.com")
browser(action="screenshot", profile="openclaw")
Key Differences from Extension Relay
| Feature | Extension Relay | CDP Direct |
|---------|----------------|------------|
| Stability | Frequent disconnects | Rock solid |
| Setup | Install extension + attach tab | One-time script |
| Auth/Cookies | Shares your main Chrome | Dedicated profile |
| Speed | Extra hop through extension | Direct protocol |
| Headless | No | Optional (--headless=new) |
Dedicated Profile
The CDP browser uses ~/.chrome-debug-profile β a separate Chrome profile. This means:
Tips
targetId to pin a specific tab--headless=new to the launch command for invisible operationpkill -f 'remote-debugging-port=9222' && sleep 1 && bash scripts/setup-cdp.shTroubleshooting
setup-cdp.sh or launch manuallylsof -i :9222pkill -f chrome-debug-profile~/.chrome-debug-profile and re-run setupπ Tips & Best Practices
targetId to pin a specific tab--headless=new to the launch command for invisible operationpkill -f 'remote-debugging-port=9222' && sleep 1 && bash scripts/setup-cdp.shTroubleshooting
setup-cdp.sh or launch manuallylsof -i :9222pkill -f chrome-debug-profile~/.chrome-debug-profile and re-run setup