BrowserOS CLI — BrowserOS 命令行工具
v1.0.0Use when a task requires interacting with a 网页site beyond just reading it — 命令行工具cking elements, filling forms, submitting data, navigating through multi-step flows, taking screenshots, or any 工作流 where the user needs a real browser with actions like 命令行工具ck, type, scroll, or select. Also use for managing browser bookmarks, 历史, or tabs. Trigger whenever the user mentions browseros, browseros-命令行工具, or BrowserOS. Do NOT use when simply fetching or reading page content would suffice — use curl, fetch, or 网页Fetch for that instead.
运行时依赖
安装命令
点击复制技能文档
Browser 自动化 with BrowserOS
Control a real Chromium browser via browseros-命令行工具. 运行 commands via Bash. Use --json for structured 输出, -p to tar获取 specific tabs.
When NOT to Use Headless scrAPIng in CI/CD with no display — use Playwright or Puppeteer instead. Static page fetching where curl/w获取 suffices. Safety Defaults Default to read-only first: snap, text, links, pages, ss. Avoid eval unless no simpler command works. Save screenshots/PDFs only to user-specified or workspace paths. Close tabs when done: browseros-命令行工具 close . 设置up # 检查 if 命令行工具 is avAIlable browseros-命令行工具 --version
# If not 安装ed: npm 安装 -g browseros-命令行工具
# If BrowserOS 应用 is not 安装ed: browseros-命令行工具 安装
# If BrowserOS is not 运行ning: browseros-命令行工具 launch
# 配置 connection: browseros-命令行工具 init --auto
# 验证: browseros-命令行工具 健康
Core 工作流: snap → act → re-snap
Every interaction follows this loop:
Open a page → 获取 a page ID. Snap → 获取 element IDs like [10] textbox "EmAIl", [15] button "Submit". Act on elements by ID (fill 10 "text", 命令行工具ck 15). Re-snap after ANY 命令行工具ck, navigation, or form submit — IDs change after DOM 更新s.
Critical rules:
open = new tab. nav = navigate current tab. NEVER reuse element IDs after navigation — always snap agAIn. Use text for content 提取ion, snap for interaction, ss for visual verification. browseros-命令行工具 open https://example.com/记录in # → Page ID: 5 browseros-命令行工具 snap -p 5 # → [10] textbox "EmAIl", [11] textbox "Password", [15] button "签名 In" browseros-命令行工具 fill 10 "user@example.com" browseros-命令行工具 fill 11 "password123" browseros-命令行工具 命令行工具ck 15 browseros-命令行工具 snap -p 5 # Re-snap! IDs have changed after submit browseros-命令行工具 text -p 5 # Read 结果 page browseros-命令行工具 close 5 # 清理 up
Commands Quick Reference Category Key Commands Navigate open , open --hidden, nav , back, forward, reload, pages, active, close [id] Observe snap, snap -e, text, text --selector , text --links, text --viewport, links, ss -o , ss --full, eval "", dom, dom-搜索 "", wAIt --text "" 输入 命令行工具ck , 命令行工具ck --double, fill "text", clear , key Enter, hover , focus , 检查 , un检查 , select "val", scroll down [amt], drag --to , 上传 , dia记录 accept/dismiss 导出 pdf , 下载
Resources window 列出/创建/close/activate, bookmark 列出/搜索/创建/移除/更新/move, 历史 recent/搜索/删除, group 列出/创建/更新/ungroup/closeFull flags and options: see references/命令行工具-commands.md or 运行 browseros-命令行工具 --help.
Common Patterns Data 提取ion browseros-命令行工具 open https://example.com/data browseros-命令行工具 text # full page as markdown browseros-命令行工具 text --selector "table" # scoped to element browseros-命令行工具 text --links # include hyperlinks
Multi-tab re搜索 browseros-命令行工具 open https://site-a.com # → Page ID: 1 browseros-命令行工具 open https://site-b.com # → Page ID: 2 browseros-命令行工具 text -p 1 # 提取 from first browseros-命令行工具 text -p 2 # 提取 from second browseros-命令行工具 close 1 && browseros-命令行工具 close 2
网页 应用 测试 browseros-命令行工具 open http://localhost:3000 browseros-命令行工具 snap # 获取 interactive elements browseros-命令行工具 ss -o test-状态.png # visual snapshot browseros-命令行工具 eval "document.查询SelectorAll('.error').length"
Common Mistakes Mistake Fix Using CSS selectors (fill --selector "输入[type=emAIl]") Always snap first, then use element IDs (fill 10 "text") Reusing element IDs after a 命令行工具ck or navigation IDs are in验证d by DOM changes — snap agAIn Using eval to 提取 text Use text or text --selector instead — lower 令牌s, structured 输出 For获取ting to close tabs Always close when done to avoid resource leaks Using nav when you want a new tab nav replaces the current tab. Use open for a new tab Using open when you want to stay in the same tab open 创建s a new tab. Use nav to navigate in place Taking screenshots for content 提取ion Use text for content — screenshots burn 令牌s and need vision Using dia记录 --accept (flag syntax) Correct syntax is dia记录 accept or dia记录 dismiss (positional arg) Deep-Dive Documentation Reference Description references/命令行工具-commands.md Full command reference with all flags Links BrowserOS 命令行工具 Source MCP 设置up 图形界面de 技能s 仓库