OpenClaw Skills 浏览器自动化(Browser Use)技能使用参考手册
概述
Browser Use 是用于自动化浏览器交互的 OpenClaw 技能,支持网页导航、表单填写、截图、数据提取等功能,适用于网页测试、数据采集、自动化工作流等场景。该技能能够让 AI 代理像真人一样操作浏览器,绕过大部分自动化风控,支持多种浏览器模式,包括无头 Chromium、真实 Chrome 浏览器和云端浏览器,可实现复杂的多步骤工作流。
该技能由 ShawnPana 开发,在 ClawHub 平台上是热门的自动化技能之一,能够为 AI 代理赋予强大的浏览器操作能力,解决了 AI 只能通过 API 获取静态数据而无法直接操作浏览器的痛点。
技能信息
- 名称:browser-use
- 描述:自动化浏览器交互,用于网页测试、表单填写、截图和数据提取。当用户需要导航网站、与网页交互、填写表单、截图或从网页提取信息时使用该技能。
- 版本:1.0.2
- 作者:ShawnPana
- 依赖:
- 需要安装 browser-use 工具
- 支持 Chromium、Chrome 浏览器,或云端浏览器
- 触发词:"浏览器自动化"、"网页交互"、"表单填写"、"网页截图"、"数据提取"
👤 作者:Peter Steinberger
🦞 官方地址:https://clawhub.ai/ShawnPana/browser-use
👉 Skills 下载地址:browser-use-1.0.2.zip
前提条件
在使用该技能之前,必须安装并配置 browser-use 工具,运行以下诊断命令验证安装:
browser-use doctor
更多信息请查看:https://github.com/browser-use/browser-use/blob/main/browser_use/skill_cli/README.md
核心工作流
- 导航:
browser-use open <url>- 打开指定 URL(如果需要则启动浏览器) - 检查:
browser-use state- 返回可点击元素及其索引 - 交互:使用
state命令返回的索引进行交互(如browser-use click 5、browser-use input 3 "文本内容") - 验证:使用
browser-use state或browser-use screenshot确认操作结果 - 重复:浏览器会在命令之间保持打开状态
浏览器模式
browser-use --browser chromium open <url> # 默认:无头Chromium
browser-use --browser chromium --headed open <url> # 可见的Chromium窗口
browser-use --browser real open <url> # 真实Chrome浏览器(无配置文件则使用全新配置)
browser-use --browser real --profile "Default" open <url> # 使用你的登录会话的真实Chrome
browser-use --browser remote open <url> # 云端浏览器
- chromium:快速、隔离,默认无头模式
- real:使用真实的 Chrome 二进制文件。如果不指定
--profile,会在~/.config/browseruse/profiles/cli/使用一个持久但空的 CLI 配置文件。如果指定--profile "ProfileName",会复制你实际的 Chrome 配置文件(包括 Cookie、登录信息、扩展程序) - remote:支持代理的云端托管浏览器
基本命令
导航
browser-use open <url> # 导航到指定URL
browser-use back # 后退
browser-use scroll down # 向下滚动(使用--amount N指定像素数)
browser-use scroll up # 向上滚动
browser-use scroll down --amount 1000 # 滚动指定像素数(默认:500)
browser-use switch <tab> # 切换到指定索引的标签页
browser-use close-tab # 关闭当前标签页
browser-use close-tab <tab> # 关闭指定标签页
页面状态
browser-use state # 获取URL、标题和可点击元素
browser-use screenshot # 截图(输出base64格式)
browser-use screenshot path.png # 将截图保存到文件
browser-use screenshot --full path.png # 全页截图
交互操作
browser-use click <index> # 点击指定索引的元素
browser-use type "text" # 向已聚焦的元素输入文本
browser-use input <index> "text" # 点击元素,然后输入文本
browser-use keys "Enter" # 发送键盘按键
browser-use keys "Control+a" # 发送组合键
browser-use select <index> "option" # 选择下拉菜单的选项
browser-use hover <index> # 悬停在元素上(触发CSS :hover效果)
browser-use dblclick <index> # 双击元素
browser-use rightclick <index> # 右键点击元素(打开上下文菜单)
使用browser-use state命令返回的索引进行操作。
JavaScript 与数据提取
browser-use eval "document.title" # 执行JavaScript,返回结果
browser-use get title # 获取页面标题
browser-use get html # 获取完整页面HTML
browser-use get html --selector "h1" # 获取指定元素的HTML
browser-use get text <index> # 获取元素的文本内容
browser-use get value <index> # 获取输入框/文本域的值
browser-use get attributes <index> # 获取元素的所有属性
browser-use get bbox <index> # 获取元素的边界框(x, y, width, height)
等待操作
browser-use wait selector "h1" # 等待元素出现
browser-use wait text "Success" # 等待文本出现
会话管理
browser-use sessions # 列出活跃会话
browser-use close # 关闭当前会话
browser-use close --all # 关闭所有会话
AI 代理任务
远程模式选项
使用--browser remote时,支持以下额外选项:
## 指定LLM模型
browser-use -b remote run "任务描述" --llm gpt-4o
browser-use -b remote run "任务描述" --llm claude-sonnet-4-20250514
## 代理配置(默认:美国)
browser-use -b remote run "任务描述" --proxy-country uk
## 会话复用
browser-use -b remote run "任务描述" --keep-alive # 任务完成后保持会话活跃
browser-use -b remote run "任务描述" --session-id abc-123 # 复用现有会话
## 执行模式
browser-use -b remote run "任务描述" --flash # 快速执行模式
browser-use -b remote run "任务描述" --wait # 等待完成(默认:异步)
## 高级选项
browser-use -b remote run "任务描述" --thinking # 扩展推理模式
browser-use -b remote run "任务描述" --no-vision # 禁用视觉功能(默认启用)
## 使用云配置文件(先创建会话,然后使用--session-id运行任务)
browser-use session create --profile <cloud-profile-id> --keep-alive
## → 返回session_id
browser-use -b remote run "任务描述" --session-id <session-id>
## 任务配置
browser-use -b remote run "任务描述" --start-url https://example.com # 从指定URL开始
browser-use -b remote run "任务描述" --allowed-domain example.com # 限制导航域名(可重复使用)
browser-use -b remote run "任务描述" --metadata key=value # 任务元数据(可重复使用)
browser-use -b remote run "任务描述" --skill-id skill-123 # 启用技能(可重复使用)
browser-use -b remote run "任务描述" --secret key=value # 机密元数据(可重复使用)
## 结构化输出和评估
browser-use task status <task-id> --step 3 # 查看指定步骤
browser-use task status <task-id> --reverse # 从最新步骤开始查看
browser-use task stop <task-id> # 停止运行中的任务
browser-use task logs <task-id> # 获取任务执行日志
云端会话管理
browser-use session list # 列出云端会话
browser-use session list --limit 20 # 显示更多会话
browser-use session list --status active # 按状态筛选
browser-use session list --json # JSON格式输出
browser-use session stop <session-id>... # 停止指定会话
browser-use session stop --all # 停止所有活跃会话
browser-use session create # 使用默认配置创建会话
browser-use session create --profile <id> # 使用云配置文件创建
browser-use session create --proxy-country uk # 使用地理代理创建
browser-use session create --start-url https://example.com
browser-use session create --screen-size 1920x1080
browser-use session create --keep-alive
browser-use session create --persist-memory
browser-use session share <session-id> # 创建公共分享链接
browser-use session share <session-id> --delete # 删除公共分享
隧道功能
browser-use tunnel <port> # 启动隧道(返回URL)
browser-use tunnel <port> # 幂等操作 - 返回现有URL
browser-use tunnel list # 显示活跃隧道
browser-use tunnel stop <port> # 停止指定隧道
browser-use tunnel stop --all # 停止所有隧道
配置文件管理
本地 Chrome 配置文件(--browser real)
browser-use -b real profile list # 列出本地Chrome配置文件
browser-use -b real profile cookies "Default" # 显示配置文件中的Cookie域名
云端配置文件(--browser remote)
browser-use -b remote profile list # 列出云端配置文件
browser-use -b remote profile list --page 2 --page-size 50
browser-use -b remote profile get <id> # 获取配置文件详情
browser-use -b remote profile create # 创建新的云端配置文件
browser-use -b remote profile create --name "我的配置文件"
browser-use -b remote profile update <id> --name "新名称"
browser-use -b remote profile delete <id>
同步功能
browser-use profile sync --from "Default" --domain github.com # 按域名同步
browser-use profile sync --from "Default" # 完整配置文件同步
browser-use profile sync --from "Default" --name "自定义名称" # 使用自定义名称同步
服务器控制
browser-use server logs # 查看服务器日志
常见工作流
暴露本地开发服务器
当你有本地开发服务器,需要云端浏览器访问时使用该工作流。 核心工作流:启动开发服务器 → 创建隧道 → 远程浏览隧道 URL。
## 1. 启动你的开发服务器
npm run dev & # localhost:3000
## 2. 通过Cloudflare隧道暴露服务
browser-use tunnel 3000
## → url: https://abc.trycloudflare.com
## 3. 现在云端浏览器可以访问你的本地服务器
browser-use --browser remote open https://abc.trycloudflare.com
browser-use state
browser-use screenshot
注意:隧道独立于浏览器会话,在browser-use close后仍然存在,可以单独管理。必须安装 Cloudflared 工具 - 运行browser-use doctor检查。
使用配置文件进行认证浏览
当任务需要访问用户已登录的网站(如 Gmail、GitHub、内部工具)时使用该工作流。 核心工作流:检查现有配置文件 → 询问用户使用哪种配置文件和浏览器模式 → 使用该配置文件浏览。只有当没有合适的配置文件时才同步 Cookie。
在浏览需要认证的网站之前,代理必须:
- 询问用户使用real(本地 Chrome)还是remote(云端)浏览器
- 列出该模式下可用的配置文件
- 询问使用哪个配置文件
- 如果没有合适的 Cookie 配置文件,提供同步选项(见下文)
步骤 1:检查现有配置文件
## 选项A:本地Chrome配置文件(--browser real)
browser-use -b real profile list
## → Default: Person 1 (user@gmail.com)
## → Profile 1: Work (work@company.com)
## 选项B:云端配置文件(--browser remote)
browser-use -b remote profile list
## → abc-123: "Chrome - Default (github.com)"
## → def-456: "Work profile"
步骤 2:使用选定的配置文件浏览
## 真实浏览器 - 使用带有现有登录会话的本地Chrome
browser-use --browser real --profile "Default" open https://github.com
## 云端浏览器 - 使用带有同步Cookie的云端配置文件
browser-use --browser remote --profile abc-123 open https://github.com
Cookie 同步
- 询问使用哪个本地 Chrome 配置文件
- 询问同步哪些域名 - 不要默认同步完整配置文件
- 确认后再继续
查看本地配置文件的 Cookie:
browser-use -b real profile cookies "Default"
## → youtube.com: 23
## → google.com: 18
## → github.com: 2
按域名同步(推荐):
browser-use profile sync --from "Default" --domain github.com
## 创建新的云端配置文件:"Chrome - Default (github.com)"
## 仅同步github.com的Cookie
完整配置文件同步(谨慎使用):
browser-use profile sync --from "Default"
## 同步所有Cookie - 包括敏感数据、跟踪Cookie、所有会话令牌
细粒度控制(高级):
## 将Cookie导出到文件,手动编辑,然后导入
browser-use --browser real --profile "Default" cookies export /tmp/cookies.json
browser-use --browser remote --profile <id> cookies import /tmp/cookies.json
元数据信息
该技能的元数据信息如下:
{
"ownerId": "kn71fxj97n86164tdd84bymp3n7zypxq",
"slug": "browser-use",
"version": "1.0.2",
"publishedAt": 1771476812023
}
免费 AI IDE


更多建议: