返回顶部
a

agent-browser智能浏览器代理

Headless browser automation CLI optimized for AI agents with accessibility tree snapshots and ref-based element selection

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
104
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

agent-browser

技能名称: agent-browser
详细描述:

Agent Browser 技能

利用可访问性树快照与引用实现确定性元素选择,实现快速浏览器自动化。

为何使用此工具而非内置浏览器工具

使用 agent-browser 的场景:

  • - 自动化多步骤工作流
  • 需要确定性元素选择
  • 性能至关重要
  • 处理复杂单页应用
  • 需要会话隔离

使用内置浏览器工具的场景:

  • - 需要截图/PDF 用于分析
  • 需要视觉检查
  • 需要浏览器扩展集成

核心工作流

bash

1. 导航并快照


agent-browser open https://example.com
agent-browser snapshot -i --json

2. 从 JSON 解析引用,然后交互

agent-browser click @e2 agent-browser fill @e3 text

3. 页面变化后重新快照

agent-browser snapshot -i --json

关键命令

导航

bash agent-browser open agent-browser back | forward | reload | close

快照(始终使用 -i --json)

bash agent-browser snapshot -i --json # 交互元素,JSON 输出 agent-browser snapshot -i -c -d 5 --json # + 紧凑模式,深度限制 agent-browser snapshot -s #main -i # 限定选择器范围

交互(基于引用)

bash agent-browser click @e2 agent-browser fill @e3 text agent-browser type @e3 text agent-browser hover @e4 agent-browser check @e5 | uncheck @e5 agent-browser select @e6 value agent-browser press Enter agent-browser scroll down 500 agent-browser drag @e7 @e8

获取信息

bash agent-browser get text @e1 --json agent-browser get html @e2 --json agent-browser get value @e3 --json agent-browser get attr @e4 href --json agent-browser get title --json agent-browser get url --json agent-browser get count .item --json

检查状态

bash agent-browser is visible @e2 --json agent-browser is enabled @e3 --json agent-browser is checked @e4 --json

等待

bash agent-browser wait @e2 # 等待元素 agent-browser wait 1000 # 等待毫秒数 agent-browser wait --text Welcome # 等待文本 agent-browser wait --url /dashboard # 等待 URL agent-browser wait --load networkidle # 等待网络空闲 agent-browser wait --fn window.ready === true

会话(隔离浏览器)

bash agent-browser --session admin open site.com agent-browser --session user open site.com agent-browser session list

或通过环境变量:AGENTBROWSERSESSION=admin agent-browser ...

状态持久化

bash agent-browser state save auth.json # 保存 Cookie/存储 agent-browser state load auth.json # 加载(跳过登录)

截图与 PDF

bash agent-browser screenshot page.png agent-browser screenshot --full page.png agent-browser pdf page.pdf

网络控制

bash agent-browser network route /ads/* --abort # 拦截 agent-browser network route /api/* --body {x:1} # 模拟 agent-browser network requests --filter api # 查看

Cookie 与存储

bash agent-browser cookies # 获取所有 agent-browser cookies set name value agent-browser storage local key # 获取 localStorage agent-browser storage local set key val

标签页与框架

bash agent-browser tab new https://example.com agent-browser tab 2 # 切换到标签页 agent-browser frame @e5 # 切换到 iframe agent-browser frame main # 返回主框架

快照输出格式

json
{
success: true,
data: {
snapshot: ...,
refs: {
e1: {role: heading, name: Example Domain},
e2: {role: button, name: Submit},
e3: {role: textbox, name: Email}
}
}
}

最佳实践

  1. 1. 始终使用 -i 标志 - 聚焦于交互元素
  2. 始终使用 --json - 更易解析
  3. 等待稳定 - agent-browser wait --load networkidle
  4. 保存认证状态 - 使用 state save/load 跳过登录流程
  5. 使用会话 - 隔离不同浏览器上下文
  6. 使用 --headed 调试 - 查看正在发生什么

示例:搜索与提取

bash
agent-browser open https://www.google.com
agent-browser snapshot -i --json

AI 识别搜索框 @e1


agent-browser fill @e1 AI agents
agent-browser press Enter
agent-browser wait --load networkidle
agent-browser snapshot -i --json

AI 识别结果引用


agent-browser get text @e3 --json
agent-browser get attr @e4 href --json

示例:多会话测试

bash

管理员会话


agent-browser --session admin open app.com
agent-browser --session admin state load admin-auth.json
agent-browser --session admin snapshot -i --json

用户会话(同时进行)

agent-browser --session user open app.com agent-browser --session user state load user-auth.json agent-browser --session user snapshot -i --json

安装

bash
npm install -g agent-browser
agent-browser install # 下载 Chromium
agent-browser install --with-deps # Linux:+ 系统依赖

致谢

技能由 Yossi Elkrief (@MaTriXy) 创建

agent-browser CLI 由 Vercel Labs 开发

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 agent-browser-clawdbot-20260401-1775905681 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 agent-browser-clawdbot-20260401-1775905681 技能

通过命令行安装

skillhub install agent-browser-clawdbot-20260401-1775905681

下载

⬇ 下载 agent-browser v1.0.0(免费)

文件大小: 2.67 KB | 发布时间: 2026-4-12 08:40

v1.0.0 最新 2026-4-12 08:40
Initial release of Agent Browser Skill for CLI-based browser automation.

- Enables AI agents to automate browsers with accessibility tree snapshots and ref-based element selection.
- Supports fast, deterministic multi-step workflows, including navigation, interaction, information extraction, and session isolation.
- Provides comprehensive commands for interaction (click, fill, type), state checks, waiting, session management, network control, cookies, tabs, frames, and state persistence.
- Optimized for complex SPAs and critical performance scenarios.
- Includes example workflows, best practices, and installation steps for quick setup.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部