首页龙虾技能列表 › Agent Browser — 浏览器自动化工具

Agent Browser — 浏览器自动化工具

v0.1.0

自动化浏览器交互,用于网页测试、表单填写、截图和数据提取。支持导航、元素交互、截图、视频录制、页面分析等功能。

4· 4,163·12 当前·14 累计
by @murphykobe (Murphy Liu)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/4/11
安全扫描
VirusTotal
可疑
查看报告
OpenClaw
安全
high confidence
该技能的文件、模板和运行指令与浏览器自动化工具一致,虽然模板中包含保存会话状态、代理轮换、文件上传和忽略HTTPS错误等功能,这些可能带来正常的运营和隐私风险,需要妥善管理。
评估建议
["该包看似是一个直接的浏览器自动化助手。安装或使用前,请考虑以下几点:","(1) 技能假设一个单独的 'agent-browser' 二进制文件 — 确认该二进制文件的来源和可信度 trước运行调用它的模板。","(2) 保存的会话状态文件(auth-state.json 等)包含 cookie 和令牌 — 将它们视为秘密:不要提交到版本控制,且不再需要时删除。","(3) 代理轮换和认证代理可以用于合法的地理测试,但在用于激进的网页抓取时可能违反目标网站的服务条款或法律;审查法律/道德约束。","(4) 模板显示在环境变量或代理 URL 中嵌入凭据 — 避免在脚本或日志中硬编码秘密。","(5) 工具可以上传本地文件并连接到 CDP 端口 — 避免运行指向敏感本地路径或连接到暴露的远程调试端口的脚本。","(6) 使用类似 --ignore-https-errors 的选项或执行 TLS 检查的代理可能会使您暴露于 MITM 风险 —谨慎使用。审查并清理包含的模板在将它们运行在生产环境之前。"]...
详细分析 ▾
用途与能力
名称/描述与提供的命令、引用和模板匹配(导航、快照、交互、截图、会话持久性、代理支持、录制)。代理轮换、会话保存和抓取示例在浏览器自动化工具的范围内。
指令范围
运行时指令和模板指示读写会话状态文件,使用环境变量为凭据,设置代理,上传本地文件,并可选使用 "--ignore-https-errors"。这些操作对于此类技能是预期的,但可以暴露敏感数据(auth-state 文件、凭据、局部文件)。没有指令明确将数据泄露到意外的远程端点。
安装机制
无安装规格(仅指令) — 安装风险最低。该包包括 shell 模板,但在安装期间不下载或提取外部代码。
凭证需求
技能声明没有必需的环境变量或凭据(primaryEnv none)。模板推荐使用环境变量为凭据和代理 URL(可选)。这是合理的,但保存的会话文件和嵌入的代理凭据示例可以包含秘密,应保护。
持久化与权限
always:false 且未请求系统范围的配置更改。技能建议保存和加载会话状态文件(本地文件),这对于自动化是正常的;默认允许自主调用,但未与其他红旗组合。
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv0.1.02026/1/26

初始发布:自动化浏览器交互用于网页测试、自动化和数据提取。- 支持导航、表单填写、点击、快照和页面分析。- 提供截图、PDF 创建、视频录制和鼠标控制命令。- 通过引用或语义定位器(角色、文本、标签等)启用元素交互。- 包括 cookie/存储/会话管理、网络拦截、标签/窗口/框架控制和对话处理功能。- 提供灵活的等待条件和浏览器/设备模拟选项。- 以 JSON 输出结果,支持无头和有头浏览。

● 可疑

安装命令 点击复制

官方npx clawhub@latest install agent-browser-2
镜像加速npx clawhub@latest install agent-browser-2 --registry https://cn.clawhub-mirror.com

技能文档

快速开始

agent-browser open         # 打开页面
agent-browser snapshot -i       # 获取可交互元素(带引用)
agent-browser click @e1         # 点击元素(通过引用)
agent-browser fill @e2 "text"   # 填写输入框(通过引用)
agent-browser close             # 关闭浏览器

核心工作流程

  • 导航:agent-browser open
  • 快照:agent-browser snapshot -i(返回带引用如 @e1@e2 的元素)
  • 使用快照中的引用进行交互
  • 导航后或 DOM 有重大变化时重新快照

命令

导航

agent-browser open       # 导航到 URL(别名:goto, navigate)
                              # 支持:https://, http://, file://, about:, data://
                              # 如未指定协议,自动添加 https://
agent-browser back            # 后退
agent-browser forward          # 前进
agent-browser reload          # 刷新页面
agent-browser close           # 关闭浏览器(别名:quit, exit)
agent-browser connect 9222    # 通过 CDP 端口连接浏览器

快照(页面分析)

agent-browser snapshot            # 完整可访问性树
agent-browser snapshot -i         # 仅获取可交互元素(推荐)
agent-browser snapshot -c         # 紧凑输出
agent-browser snapshot -d 3       # 限制深度为 3
agent-browser snapshot -s "#main" # 限定 CSS 选择器范围

交互(使用快照中的 @ref)

agent-browser click @e1           # 点击
agent-browser dblclick @e1        # 双击
agent-browser focus @e1           # 聚焦元素
agent-browser fill @e2 "text"     # 清空并输入
agent-browser type @e2 "text"     # 输入不清空
agent-browser press Enter         # 按键(别名:key)
agent-browser press Control+a     # 组合键
agent-browser keydown Shift       # 按住按键
agent-browser keyup Shift         # 松开按键
agent-browser hover @e1           # 悬停
agent-browser check @e1           # 勾选复选框
agent-browser uncheck @e1         # 取消勾选
agent-browser select @e1 "value"  # 选择下拉选项
agent-browser select @e1 "a" "b"  # 多选
agent-browser scroll down 500     # 滚动页面(默认:向下 300px)
agent-browser scrollintoview @e1 # 滚动元素到可见区域(别名:scrollinto)
agent-browser drag @e1 @e2        # 拖放
agent-browser upload @e1 file.pdf # 上传文件

获取信息

agent-browser get text @e1        # 获取元素文本
agent-browser get html @e1        # 获取 innerHTML
agent-browser get value @e1       # 获取输入值
agent-browser get attr @e1 href   # 获取属性
agent-browser get title           # 获取页面标题
agent-browser get url             # 获取当前 URL
agent-browser get count ".item"   # 统计匹配元素数量
agent-browser get box @e1         # 获取边界框
agent-browser get styles @e1      # 获取计算样式(字体、颜色、背景等)

检查状态

agent-browser is visible @e1      # 检查是否可见
agent-browser is enabled @e1      # 检查是否启用
agent-browser is checked @e1      # 检查是否已勾选

截图和 PDF

agent-browser screenshot          # 截图输出到标准输出
agent-browser screenshot path.png # 保存到文件
agent-browser screenshot --full   # 整页截图
agent-browser pdf output.pdf      # 保存为 PDF

视频录制

agent-browser record start ./demo.webm    # 开始录制(使用当前 URL 和状态)
agent-browser click @e1                   # 执行操作
agent-browser record stop                 # 停止并保存视频
agent-browser record restart ./take2.webm # 停止当前并开始新录制

录制会创建一个新上下文,但会保留会话中的 cookies 和存储。如果没有提供 URL,会自动返回当前页面。要制作流畅的演示,建议先探索,然后开始录制。

等待

agent-browser wait @e1                     # 等待元素出现
agent-browser wait 2000                    # 等待毫秒数
agent-browser wait --text "Success"        # 等待文本出现(-t)
agent-browser wait --url "/dashboard"     # 等待 URL 匹配(-u)
agent-browser wait --load networkidle       # 等待网络空闲(-l)
agent-browser wait --fn "window.ready"     # 等待 JS 条件(-f)

鼠标控制

agent-browser mouse move 100 200      # 移动鼠标
agent-browser mouse down left         # 按下鼠标按钮
agent-browser mouse up left           # 松开鼠标按钮
agent-browser mouse wheel 100         # 滚动鼠标滚轮

语义定位器(ref 的替代方案)

agent-browser find role button click --name "Submit"
agent-browser find text "Sign In" click
agent-browser find text "Sign In" click --exact      # 精确匹配
agent-browser find label "Email" fill "user@test.com"
agent-browser find placeholder "Search" type "query"
agent-browser find alt "Logo" click
agent-browser find title "Close" click
agent-browser find testid "submit-btn" click
agent-browser find first ".item" click
agent-browser find last ".item" click
agent-browser find nth 2 "a" hover

浏览器设置

agent-browser set viewport 1920 1080          # 设置视口大小
agent-browser set device "iPhone 14"          # 模拟设备
agent-browser set geo 37.7749 -122.4194       # 设置地理位置(别名:geolocation)
agent-browser set offline on                  # 切换离线模式
agent-browser set headers '{"X-Key":"v"}'     # 额外 HTTP 头
agent-browser set credentials user pass       # HTTP 基本认证(别名:auth)
agent-browser set media dark                  # 模拟深色方案
agent-browser set media light reduced-motion  # 浅色模式 + 减少动画

Cookies 和存储

agent-browser cookies                     # 获取所有 cookies
agent-browser cookies set name value      # 设置 cookie
agent-browser cookies clear               # 清除 cookies
agent-browser storage local               # 获取所有 localStorage
agent-browser storage local key           # 获取指定 key
agent-browser storage local set k v       # 设置值
agent-browser storage local clear         # 清除所有

网络

agent-browser network route               # 拦截请求
agent-browser network route  --abort      # 阻止请求
agent-browser network route  --body '{}'  # 模拟响应
agent-browser network unroute [url]            # 移除路由
agent-browser network requests                 # 查看跟踪的请求
agent-browser network requests --filter api    # 过滤请求

标签页和窗口

agent-browser tab                 # 列出标签页
agent-browser tab new [url]       # 新建标签页
agent-browser tab 2               # 切换到指定索引的标签页
agent-browser tab close           # 关闭当前标签页
agent-browser tab close 2         # 关闭指定索引的标签页
agent-browser window new          # 新建窗口

框架

agent-browser frame "#iframe"     # 切换到 iframe
agent-browser frame main          # 返回主框架

对话框

agent-browser dialog accept [text]  # 接受对话框
agent-browser dialog dismiss        # 关闭对话框

JavaScript

agent-browser eval "document.title"   # 执行 JavaScript

全局选项

agent-browser --session  ...    # 隔离的浏览器会话
agent-browser --json ...              # JSON 输出(便于解析)
agent-browser --headed ...            # 显示浏览器窗口(非无头模式)
agent-browser --full ...              # 整页截图(-f)
agent-browser --cdp  ...       # 通过 Chrome DevTools Protocol 连接
agent-browser -p  ...       # 云浏览器提供商(--provider)
agent-browser --proxy  ...       # 使用代理服务器
agent-browser --headers  ...   # HTTP 头(作用于 URL 的源)
agent-browser --executable-path 

# 自定义浏览器可执行文件路径 agent-browser --extension ... # 加载浏览器扩展(可重复) agent-browser --help # 显示帮助(-h) agent-browser --version # 显示版本(-V) agent-browser --help # 显示命令详细帮助

代理支持

agent-browser --proxy http://proxy.com:8080 open example.com
agent-browser --proxy http://user:pass@proxy.com:8080 open example.com
agent-browser --proxy socks5://proxy.com:1080 open example.com

环境变量

AGENT_BROWSER_SESSION="mysession"            # 默认会话名称
AGENT_BROWSER_EXECUTABLE_PATH="/path/chrome" # 自定义浏览器路径
AGENT_BROWSER_EXTENSIONS="/ext1,/ext2"       # 逗号分隔的扩展路径
AGENT_BROWSER_PROVIDER="your-cloud-browser-provider"  # 云浏览器提供商(选择 browseruse 或 browserbase)
AGENT_BROWSER_STREAM_PORT="9223"             # WebSocket 流端口
AGENT_BROWSER_HOME="/path/to/agent-browser"  # 自定义安装位置(用于 daemon.js)

示例:表单提交

agent-browser open https://example.com/form
agent-browser snapshot -i
# 输出显示: textbox "Email" [ref=e1], textbox "Password" [ref=e2], button "Submit" [ref=e3]

agent-browser fill @e1 "user@example.com" agent-browser fill @e2 "password123" agent-browser click @e3 agent-browser wait --load networkidle agent-browser snapshot -i # 检查结果

示例:使用保存的状态进行认证

# 登录一次
agent-browser open https://app.example.com/login
agent-browser snapshot -i
agent-browser fill @e1 "username"
agent-browser fill @e2 "password"
agent-browser click @e3
agent-browser wait --url "/dashboard"
agent-browser state save auth.json

# 之后的会话:加载保存的状态 agent-browser state load auth.json agent-browser open https://app.example.com/dashboard

会话(并行浏览器)

agent-browser --session test1 open site-a.com
agent-browser --session test2 open site-b.com
agent-browser session list

JSON 输出(便于解析)

添加 --json 获取机器可读输出:

agent-browser snapshot -i --json
agent-browser get text @e1 --json

调试

agent-browser --headed open example.com   # 显示浏览器窗口
agent-browser --cdp 9222 snapshot         # 通过 CDP 端口连接
agent-browser connect 9222                # 替代:连接命令
agent-browser console                     # 查看控制台消息
agent-browser console --clear             # 清除控制台
agent-browser errors                      # 查看页面错误
agent-browser errors --clear              # 清除错误
agent-browser highlight @e1               # 高亮元素
agent-browser trace start                 # 开始记录跟踪
agent-browser trace stop trace.zip        # 停止并保存跟踪
agent-browser record start ./debug.webm   # 从当前页面录制视频
agent-browser record stop                 # 保存录制

深入文档

详细模式和最佳实践请参阅:

参考描述
references/snapshot-refs.md引用生命周期、失效规则、故障排除
references/session-management.md并行会话、状态持久化、并发抓取
references/authentication.md登录流程、OAuth、2FA 处理、状态重用
references/video-recording.md调试和文档的视频录制工作流
references/proxy-support.md代理配置、地理测试、轮换代理

可用模板

常见模式的可执行工作流脚本:

模板描述
templates/form-automation.sh带验证的表单自动化
templates/authenticated-session.sh登录一次,复用状态
templates/capture-workflow.sh带截图的内容提取
用法:
./templates/form-automation.sh https://example.com/form
./templates/authenticated-session.sh https://app.example.com/login
./templates/capture-workflow.sh https://example.com ./output

HTTPS 证书错误

对于自签名或无效证书的站点:

agent-browser open https://localhost:8443 --ignore-https-errors

数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务