Claude Chrome — Browser Automation via Claude Code
Use Claude Code's Chrome integration to browse the web, interact with pages, and automate browser tasks. This is an alternative to OpenClaw's built-in browser tools (Chrome Relay, OpenClaw profile).
Prerequisites
- 1. Claude Code installed on the node (e.g.
/opt/homebrew/bin/claude) - Claude Code Chrome extension installed and enabled in Chrome
- Chrome running on the node
How It Works
Claude Code can connect to Chrome via its built-in browser extension (MCP server). When enabled, Claude Code gains browser tools — it can navigate pages, click elements, fill forms, read content, and more.
Step 1: Check if Chrome Extension is Active
Look for the native host process to confirm the Chrome extension is running:
CODEBLOCK0
If this returns a PID, the Chrome extension bridge is active and ready.
Step 2: Run Claude Code with Chrome
Use nodes.run with your node to execute browser tasks:
CODEBLOCK1
Flags:
- -
--dangerously-skip-permissions — auto-approve all actions (required for automation) - INLINECODE3 — enable Chrome browser integration
- INLINECODE4 /
--print — non-interactive print mode (required for automated use) - INLINECODE6 — login shell to ensure PATH is loaded
Timeout: See benchmarks below for guidance. Recommended defaults:
- - Simple tasks (single page read):
commandTimeoutMs=30000 (30 seconds) - Medium complexity (multi-step navigation):
commandTimeoutMs=120000 (2 minutes) - Complex workflows (multiple pages + summarization):
commandTimeoutMs=180000 (3 minutes)
Performance Benchmarks
| Task Type | Example | Duration | Recommended Timeout |
|---|
| Simple | Read button text on Google | 13s | 30s (30000ms) |
| Medium |
Wikipedia search + navigate + summarize | 76s | 2min (120000ms) |
|
Complex | Multi-page navigation + external links | ~90s+ | 3min (180000ms) |
Gateway timeout note: OpenClaw's gateway has a hardcoded 10-second connection timeout. Commands will error immediately but continue running in the background. Results arrive via system messages when complete.
Limitations
- - Domain permissions: Claude Code's Chrome extension may require user approval for new domains (cannot be automated)
- Gateway timeout: Initial connection times out at 10s, but commands continue running
- Desktop required: Only works on nodes with a desktop environment, Chrome, and the extension active
Tips
- - Always use
--dangerously-skip-permissions for automated runs - Always use
-p / --print for non-interactive output - Always use
bash -lc for login shell (PATH loading) - Be aggressive with timeouts - commands complete in background even after gateway timeout
- Claude Code can combine coding and browsing in a single session
- Check the native host process before attempting browser tasks
- For simple data scraping, consider
web_fetch instead (faster, no domain permissions needed)
Claude Chrome — 通过 Claude Code 实现浏览器自动化
使用 Claude Code 的 Chrome 集成功能浏览网页、与页面交互并自动化浏览器任务。这是 OpenClaw 内置浏览器工具(Chrome Relay、OpenClaw 配置文件)的替代方案。
前提条件
- 1. 节点上已安装 Claude Code(例如 /opt/homebrew/bin/claude)
- Chrome 中已安装并启用 Claude Code Chrome 扩展程序
- 节点上正在运行 Chrome
工作原理
Claude Code 可通过其内置浏览器扩展程序(MCP 服务器)连接到 Chrome。启用后,Claude Code 将获得浏览器工具——它可以导航页面、点击元素、填写表单、读取内容等。
步骤 1:检查 Chrome 扩展程序是否激活
查找原生主机进程以确认 Chrome 扩展程序正在运行:
bash
nodes.run node= command=[bash, -lc, pgrep -f \claude --chrome-native-host\]
如果返回 PID,则表示 Chrome 扩展程序桥接已激活并准备就绪。
步骤 2:使用 Chrome 运行 Claude Code
使用 nodes.run 在节点上执行浏览器任务:
bash
nodes.run node= commandTimeoutMs=120000 command=[bash, -lc, claude --dangerously-skip-permissions --chrome -p \Go to example.com and read the headline\]
标志说明:
- - --dangerously-skip-permissions — 自动批准所有操作(自动化必需)
- --chrome — 启用 Chrome 浏览器集成
- -p / --print — 非交互式打印模式(自动化使用必需)
- bash -lc — 登录 shell 以确保加载 PATH
超时设置: 请参考下方基准测试。推荐默认值:
- - 简单任务(单页读取):commandTimeoutMs=30000(30 秒)
- 中等复杂度(多步骤导航):commandTimeoutMs=120000(2 分钟)
- 复杂工作流(多页面 + 摘要生成):commandTimeoutMs=180000(3 分钟)
性能基准测试
| 任务类型 | 示例 | 耗时 | 推荐超时时间 |
|---|
| 简单 | 读取 Google 上的按钮文本 | 13 秒 | 30 秒(30000 毫秒) |
| 中等 |
维基百科搜索 + 导航 + 摘要 | 76 秒 | 2 分钟(120000 毫秒) |
|
复杂 | 多页面导航 + 外部链接 | 约 90 秒以上 | 3 分钟(180000 毫秒) |
网关超时说明: OpenClaw 的网关具有硬编码的 10 秒连接超时。命令会立即报错,但会在后台继续运行。结果在完成后通过系统消息送达。
限制
- - 域名权限: Claude Code 的 Chrome 扩展程序可能需要用户批准新域名(无法自动化)
- 网关超时: 初始连接在 10 秒时超时,但命令会继续运行
- 需要桌面环境: 仅适用于具有桌面环境、Chrome 和已激活扩展程序的节点
提示
- - 自动化运行时始终使用 --dangerously-skip-permissions
- 非交互式输出始终使用 -p / --print
- 始终使用 bash -lc 作为登录 shell(加载 PATH)
- 大胆设置超时时间——即使网关超时,命令也会在后台完成
- Claude Code 可在单个会话中结合编码和浏览功能
- 在尝试浏览器任务前,先检查原生主机进程
- 对于简单的数据抓取,可考虑使用 web_fetch(更快,无需域名权限)