name: agent-browser
description: “像操纵手脚一样控制浏览器。导航、填写表单、截图,无所不能。当用户请求导航网站、填写表单、截图、提取网页数据、测试web应用或自动化浏览器工作流时使用。触发短语包括’go to [url]'、‘click on’、‘fill out the form’、‘take a screenshot’、‘scrape’、‘automate’、‘test the website’、'log into’或任何浏览器交互请求。不要用于:分享URL、嵌入链接、截图图像文件。”
description-en: “Control browser like hands and feet. Navigate, fill forms, screenshot, bring it on. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include ‘go to [url]’, ‘click on’, ‘fill out the form’, ‘take a screenshot’, ‘scrape’, ‘automate’, ‘test the website’, ‘log into’, or any browser interaction request. Do NOT load for: sharing URLs, embedding links, screenshot image files.”
description-ja: “ブラウザを手足のように操る。ページ遷移、フォーム入力、スクショ、なんでもこい。Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include ‘go to [url]’, ‘click on’, ‘fill out the form’, ‘take a screenshot’, ‘scrape’, ‘automate’, ‘test the website’, ‘log into’, or any browser interaction request. Do NOT load for: sharing URLs, embedding links, screenshot image files.”
allowed-tools: [“Bash”, “Read”]
user-invocable: false
context: fork
argument-hint: “[url] [–headless]”
代理浏览器技能
进行浏览器自动化的技能。使用agent-browser CLI来执行UI调试、验证和自动操作。
触发短语
此技能在以下短语时自动启动:
- 「打开页面」「确认URL」
- 「点击」「输入」「填写表单」
- 「截图」
- 「确认UI」「测试屏幕」
- “open this page”, “click on”, “fill the form”, “screenshot”
功能详细
执行步骤
步骤 0: 确认 agent-browser
# 安装确认
which agent-browser
# 未安装时
npm install -g agent-browser
agent-browser install
步骤 1: 分类用户请求
| 请求类型 |
对应动作 |
| 打开 URL |
agent-browser open <url> |
| 点击元素 |
快照 → agent-browser click @ref |
| 表单输入 |
快照 → agent-browser fill @ref "text" |
| 状态确认 |
agent-browser snapshot -i -c |
| 截图 |
agent-browser screenshot <path> |
| 调试 |
agent-browser --headed open <url> |
步骤 2: AI 快照工作流(推荐)
大多数操作中,首先获取快照,然后使用元素引用操作:
# 1. 打开页面
agent-browser open https://example.com
# 2. 获取快照(AI 向,仅交互元素)
agent-browser snapshot -i -c
# 输出示例:
# - link "Home" [ref=e1]
# - button "Login" [ref=e2]
# - input "Email" [ref=e3]
# - input "Password" [ref=e4]
# - button "Submit" [ref=e5]
# 3. 使用元素引用操作
agent-browser click @e2 # 点击 Login 按钮
agent-browser fill @e3 "user@example.com"
agent-browser fill @e4 "password123"
agent-browser click @e5 # 提交
步骤 3: 确认结果
# 用快照确认当前状态
agent-browser snapshot -i -c
# 或确认 URL
agent-browser get url
# 获取截图
agent-browser screenshot result.png
快速参考
基本操作
| 命令 |
说明 |
open <url> |
打开 URL |
snapshot -i -c |
AI 向快照 |
click @e1 |
点击元素 |
fill @e1 "text" |
表单输入 |
type @e1 "text" |
输入文本 |
press Enter |
按键 |
screenshot [path] |
截图 |
close |
关闭浏览器 |
导航
| 命令 |
说明 |
back |
后退 |
forward |
前进 |
reload |
重新加载 |
信息获取
| 命令 |
说明 |
get text @e1 |
获取文本 |
get html @e1 |
获取 HTML |
get url |
当前 URL |
get title |
页面标题 |
等待
| 命令 |
说明 |
wait @e1 |
等待元素 |
wait 1000 |
等待1秒 |
调试
| 命令 |
说明 |
--headed |
显示浏览器 |
console |
控制台日志 |
errors |
页面错误 |
highlight @e1 |
高亮元素 |
会话管理
并行管理多个标签/会话:
# 指定会话
agent-browser --session admin open https://admin.example.com
agent-browser --session user open https://example.com
# 会话列表
agent-browser session list
# 特定会话操作
agent-browser --session admin snapshot -i -c
MCP 浏览器工具的使用区分
| 工具 |
推荐度 |
用途 |
| agent-browser |
★★★ |
首选。AI 向快照强大 |
| chrome-devtools MCP |
★★☆ |
Chrome 已打开时 |
| playwright MCP |
★★☆ |
复杂 E2E 测试 |
原则: 先尝试 agent-browser,不行时才使用 MCP 工具。
注意事项
- agent-browser 默认无头模式
- 使用
--headed 选项可显示浏览器
- 会话在明确
close 前保持
- 需要认证的站点活用会话