← 返回
未分类 中文

browser-cdp

Real Chrome browser automation via CDP Proxy — access pages with full user login state, bypass anti-bot detection, perform interactive operations (click/fill...
使用 CDP 代理实现真实 Chrome 自动化,支持完整登录状态访问页面、绕过反爬虫检测、执行点击/填写等交互操作。
0xcjl
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 2
Stars
📥 778
下载
💾 15
安装
1
版本
#latest

概述

What is browser-cdp?

browser-cdp connects directly to your local Chrome via Chrome DevTools Protocol (CDP), giving the AI agent:

  • Full login state — your cookies and sessions are carried through
  • Anti-bot bypass — pages that block static fetchers (search results, video platforms)
  • Interactive operations — click, fill forms, scroll, drag, file upload
  • Dynamic content extraction — read JavaScript-rendered DOM
  • Screenshots — capture any page at any point

Architecture

Chrome (remote-debugging-port=9222)
    ↓ CDP WebSocket
CDP Proxy (cdp-proxy.mjs) — HTTP API on localhost:3456
    ↓ HTTP REST
OpenClaw AI Agent

Setup

1. Start Chrome with debugging port

# macOS — must use full binary path (not `open -a`)
pkill -9 "Google Chrome"; sleep 2
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
  --remote-debugging-port=9222 \
  --user-data-dir=/tmp/chrome-debug-profile \
  --no-first-run &

Verify:

curl -s http://127.0.0.1:9222/json/version

2. Start CDP Proxy

node ~/.openclaw/skills/browser-cdp/scripts/cdp-proxy.mjs &
sleep 3
curl -s http://localhost:3456/health
# {"status":"ok","connected":true,"sessions":0,"chromePort":9222}

API Reference

# List all tabs
curl -s http://localhost:3456/targets

# Open URL in new tab
curl -s "http://localhost:3456/new?url=https://example.com"

# Execute JavaScript
curl -s -X POST "http://localhost:3456/eval?target=TARGET_ID" \
  -d 'document.title'

# JS click (fast, preferred)
curl -s -X POST "http://localhost:3456/click?target=TARGET_ID" \
  -d 'button.submit'

# Real mouse click
curl -s -X POST "http://localhost:3456/clickAt?target=TARGET_ID" \
  -d '.upload-btn'

# Screenshot
curl -s "http://localhost:3456/screenshot?target=TARGET_ID&file=/tmp/shot.png"

# Scroll (lazy loading)
curl -s "http://localhost:3456/scroll?target=TARGET_ID&direction=bottom"

# Navigate
curl -s "http://localhost:3456/navigate?target=TARGET_ID&url=https://..."

# Close tab
curl -s "http://localhost:3456/close?target=TARGET_ID"

Tool Selection: Three-Layer Strategy

ScenarioUseReason
----------------------
Public pages (GitHub, Wikipedia, blogs)agent-reachFast, low token, structured
Search results (Bing/Google/YouTube)browser-cdpagent-reach blocked
Login-gated contentbrowser-cdpNo cookies in agent-reach
JS-rendered pagesbrowser-cdpReads rendered DOM
Simple automation, isolated screenshotsagent-browserNo Chrome setup
Large-scale parallel scrapingagent-reach + parallelbrowser-cdp gets rate-limited

Decision flow:

Public content → agent-reach (fast, cheap)
Search results / blocked → browser-cdp
Still fails → agent-reach fallback + record in site-patterns

Known Limitations

  • Chrome must use a separate profile (/tmp/chrome-debug-profile)
  • Same-site parallel tabs may get rate-limited
  • Node.js 22+ required (native WebSocket)
  • macOS: use full binary path to start Chrome, not open -a

Site Patterns & Usage Log

~/.openclaw/skills/browser-cdp/references/site-patterns/   # per-domain experience
~/.openclaw/skills/browser-cdp/references/usage-log.md    # per-use tracking

Origin

Adapted from eze-is/web-access (MIT) for OpenClaw.

A bug in the original (require() in ES module, reported here) is fixed in this version.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-03 04:41 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Autoresearch

0xcjl
通过迭代变异测试循环自动改进 OpenClaw 技能、提示或文章;受 Karpathy 自动研究启发,适用于用户说...
★ 2 📥 486

Merge Drafts

0xcjl
智能草稿合并工具,支持质量评估与冲突解决。可将多份草稿合并为高质量文章,支持多种输入格式。
★ 2 📥 555

humanizer-cn

0xcjl
消除中文文本的AI痕迹,使其自然流畅。基于维基百科AI写作特征指南检测24种AI模式。触发词:humanizer-cn、去除AI痕迹、去除AI写作痕迹、中文文本人性化。
★ 0 📥 547