SuperAPI AI Directory

browser-use

Testing & quality

View repository

Updated 10-15 17:34

About this skill

browser-use

Via @playwright/cli daemon connects to the user's real Chrome browser (extension mode), reusing the already logged-in session. Tabs persist across calls — the daemon process stays resident, so tabs, cookies, and login state survive across multiple calls.

Prerequisites

  1. Chrome has the Playwright MCP Bridge extension installed
  2. .env is configured with ALEX_BROWSER_BRIDGE_TOKEN(copied from the extension popup)

Core Concepts

  • Daemon persistent session: the first call automatically starts the daemon (open --extension), and all subsequent calls reuse the same session
  • Snapshot → ref → action:snapshot retrieves the page's accessibility tree, each element has a ref(e.g. e44), use click/fill/type to act on that ref
  • No foreground stealing: extension mode connects to the existing Chrome, and will not pop up a new window or steal focus
  • Token savings: snapshot output goes to a file (.playwright-cli/ directory), not dumped to stdout

Calls

# 首次打开 — 连接 Chrome 扩展(自动启动 daemon)
python3 skills/browser-use/run.py open

# 导航到 URL(自动确保 session 存在)
python3 skills/browser-use/run.py navigate --url https://x.com

# 获取页面快照(无障碍树 + 元素 ref)
python3 skills/browser-use/run.py snapshot

# 点击元素(ref 来自 snapshot)
python3 skills/browser-use/run.py click --ref e44

# 填充输入框(定位到 ref 再填入文本)
python3 skills/browser-use/run.py fill --ref e100 --text "hello world"

# 输入文本到当前焦点元素
python3 skills/browser-use/run.py type --text "search query" --submit true

# 悬停
python3 skills/browser-use/run.py hover --ref e50

# 下拉选择
python3 skills/browser-use/run.py select --ref e80 --value "option1"

# 截图
python3 skills/browser-use/run.py screenshot --filename page.png
python3 skills/browser-use/run.py screenshot --ref e44 --filename element.png
python3 skills/browser-use/run.py screenshot --full_page true --filename full.png

# 按键
python3 skills/browser-use/run.py press_key --key Enter
python3 skills/browser-use/run.py press_key --key "Control+a"

# 导航
python3 skills/browser-use/run.py go_back
python3 skills/browser-use/run.py go_forward
python3 skills/browser-use/run.py reload

# 执行 JavaScript
python3 skills/browser-use/run.py evaluate --function '() => document.title'
python3 skills/browser-use/run.py evaluate --function '(el) => el.textContent' --ref e44

# 执行 Playwright 代码
python3 skills/browser-use/run.py run_code --code 'async (page) => await page.title()'

# Tab 管理(跨调用持久!)
python3 skills/browser-use/run.py tabs                        # 列出所有 tab
python3 skills/browser-use/run.py tab_select --index 0        # 切换到 tab 0
python3 skills/browser-use/run.py tab_new --url https://...   # 新开 tab
python3 skills/browser-use/run.py tab_close --index 1         # 关闭 tab

# 调试
python3 skills/browser-use/run.py console                     # 查看 console 日志
python3 skills/browser-use/run.py network                     # 查看网络请求
python3 skills/browser-use/run.py pdf                         # 导出 PDF

# 关闭会话
python3 skills/browser-use/run.py close

Tab Reuse Workflow

Tabs persist in the daemon session. Example of reuse across calls:

# 调用 1: 打开 x.com
python3 skills/browser-use/run.py navigate --url https://x.com

# 调用 2: 直接 snapshot(还在 x.com 页面上!)
python3 skills/browser-use/run.py snapshot

# 调用 3: 操作 x.com 页面元素
python3 skills/browser-use/run.py click --ref e43

# 调用 4: 查看所有 tab
python3 skills/browser-use/run.py tabs

# 调用 5: 切换到另一个 tab
python3 skills/browser-use/run.py tab_select --index 0

Typical Scenarios

Social platforms (X / Xiaohongshu / Weibo / Zhihu)

# 打开 → 搜索 → 获取结果
python3 skills/browser-use/run.py navigate --url https://x.com/search
python3 skills/browser-use/run.py snapshot
# 找到搜索框 ref → 填入关键词
python3 skills/browser-use/run.py fill --ref SEARCH_REF --text "AI agent"
python3 skills/browser-use/run.py press_key --key Enter
python3 skills/browser-use/run.py snapshot

Posting / commenting

python3 skills/browser-use/run.py navigate --url https://x.com/compose/post
python3 skills/browser-use/run.py snapshot
python3 skills/browser-use/run.py fill --ref POST_REF --text "Hello world!"
python3 skills/browser-use/run.py click --ref SUBMIT_REF

Form filling

python3 skills/browser-use/run.py navigate --url https://example.com/form
python3 skills/browser-use/run.py snapshot
# 逐一填充字段
python3 skills/browser-use/run.py fill --ref NAME_REF --text "张三"
python3 skills/browser-use/run.py fill --ref EMAIL_REF --text "test@example.com"
python3 skills/browser-use/run.py select --ref COUNTRY_REF --value "CN"
python3 skills/browser-use/run.py click --ref SUBMIT_REF

Information gathering (scroll + multiple pages)

python3 skills/browser-use/run.py navigate --url https://www.xiaohongshu.com/explore
python3 skills/browser-use/run.py snapshot
# 滚动加载更多
python3 skills/browser-use/run.py evaluate --function '() => window.scrollBy(0, 800)'
python3 skills/browser-use/run.py snapshot
# 翻页
python3 skills/browser-use/run.py click --ref NEXT_PAGE_REF

Notes

  • The first call automatically starts the daemon + connects the Chrome extension; subsequent calls skip startup
  • snapshot returns the accessibility tree; ref is an element identifier (e.g. e44)
  • ref persists across calls within the same daemon session , but requires a new snapshot after page navigation/refresh
  • Will not open a new browser window, and will not steal foreground focus
  • The user's already logged-in cookies/session are automatically reused