← 返回
开发者工具 中文

Stable Browser

Set up reliable browser automation using Chrome DevTools Protocol (CDP) instead of the flaky browser extension relay. Use when browser relay keeps disconnect...
使用 Chrome DevTools Protocol (CDP) 建立可靠的浏览器自动化,以替代不稳定的浏览器扩展中继。适用于浏览器中继频繁断开连接的情况。
jarvis563 jarvis563 来源
开发者工具 clawhub v1.0.0 1 版本 99873.6 Key: 无需
★ 0
Stars
📥 790
下载
💾 14
安装
1
版本
#latest

概述

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:

  • WebSocket 403 errors
  • Port confusion (gateway port vs relay port)
  • Dropped connections mid-automation
  • "Can't reach browser control service" errors
  • Badge/tab attachment confusion

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

FeatureExtension RelayCDP Direct
-------------------------------------
StabilityFrequent disconnectsRock solid
SetupInstall extension + attach tabOne-time script
Auth/CookiesShares your main ChromeDedicated profile
SpeedExtra hop through extensionDirect protocol
HeadlessNoOptional (--headless=new)

Dedicated Profile

The CDP browser uses ~/.chrome-debug-profile — a separate Chrome profile. This means:

  • Log into sites once, stays logged in
  • Your main Chrome is untouched
  • No extension conflicts
  • Survives Chrome updates

Tips

  • First run: Log into any sites you need (Google, GitHub, X, LinkedIn, etc.)
  • Multiple tabs: CDP manages all tabs — use targetId to pin a specific tab
  • Headless mode: Add --headless=new to the launch command for invisible operation
  • Port conflict: If port 9222 is taken, change it in both the launch command and config
  • Restart Chrome: pkill -f 'remote-debugging-port=9222' && sleep 1 && bash scripts/setup-cdp.sh

Troubleshooting

  • "Can't reach browser": Chrome isn't running with debug port. Run setup-cdp.sh or launch manually
  • Port 9222 in use: Another Chrome or process grabbed it. Kill it: lsof -i :9222
  • Stale session: Chrome crashed. Kill and restart: pkill -f chrome-debug-profile
  • Profile corruption: Delete ~/.chrome-debug-profile and re-run setup

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 18:58 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 676 📥 325,548
ai-agent

Percept Voice Commands

jarvis563
检测语音中的唤醒词并将邮件、短信、提醒、搜索和笔记等语音指令路由到OpenClaw代理执行。
★ 0 📥 1,216
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 71 📥 181,355