← 返回
未分类 中文

BrowserOS CLI

Use when a task requires interacting with a website beyond just reading it — clicking elements, filling forms, submitting data, navigating through multi-step...
用于需要与网站交互(点击元素、填写表单、提交数据、进行多步骤导航等)的任务。
browseros-ai
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 1
Stars
📥 364
下载
💾 0
安装
1
版本
#latest

概述

Browser Automation with BrowserOS

Control a real Chromium browser via browseros-cli. Run commands via Bash. Use --json for structured output, -p to target specific tabs.

When NOT to Use

  • Headless scraping in CI/CD with no display — use Playwright or Puppeteer instead.
  • Static page fetching where curl/wget 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-cli close .

Setup

# Check if CLI is available
browseros-cli --version

# If not installed:
npm install -g browseros-cli

# If BrowserOS app is not installed:
browseros-cli install

# If BrowserOS is not running:
browseros-cli launch

# Configure connection:
browseros-cli init --auto

# Verify:
browseros-cli health

Core Workflow: snap → act → re-snap

Every interaction follows this loop:

  1. Open a page → get a page ID.
  2. Snap → get element IDs like [10] textbox "Email", [15] button "Submit".
  3. Act on elements by ID (fill 10 "text", click 15).
  4. Re-snap after ANY click, navigation, or form submit — IDs change after DOM updates.

Critical rules:

  • open = new tab. nav = navigate current tab.
  • NEVER reuse element IDs after navigation — always snap again.
  • Use text for content extraction, snap for interaction, ss for visual verification.
browseros-cli open https://example.com/login    # → Page ID: 5
browseros-cli snap -p 5                          # → [10] textbox "Email", [11] textbox "Password", [15] button "Sign In"
browseros-cli fill 10 "user@example.com"
browseros-cli fill 11 "password123"
browseros-cli click 15
browseros-cli snap -p 5                          # Re-snap! IDs have changed after submit
browseros-cli text -p 5                          # Read result page
browseros-cli close 5                            # Clean up

Commands Quick Reference

CategoryKey Commands
-----------------------
Navigateopen , open --hidden, nav , back, forward, reload, pages, active, close [id]
Observesnap, snap -e, text, text --selector , text --links, text --viewport, links, ss -o , ss --full, eval "", dom, dom-search "", wait --text ""
Inputclick , click --double, fill "text", clear , key Enter, hover , focus , check , uncheck , select "val", scroll down [amt], drag --to , upload , dialog accept/dismiss
Exportpdf , download
Resourceswindow list/create/close/activate, bookmark list/search/create/remove/update/move, history recent/search/delete, group list/create/update/ungroup/close

Full flags and options: see references/cli-commands.md or run browseros-cli --help.

Common Patterns

Data extraction

browseros-cli open https://example.com/data
browseros-cli text                         # full page as markdown
browseros-cli text --selector "table"      # scoped to element
browseros-cli text --links                 # include hyperlinks

Multi-tab research

browseros-cli open https://site-a.com      # → Page ID: 1
browseros-cli open https://site-b.com      # → Page ID: 2
browseros-cli text -p 1                    # extract from first
browseros-cli text -p 2                    # extract from second
browseros-cli close 1 && browseros-cli close 2

Web app testing

browseros-cli open http://localhost:3000
browseros-cli snap                         # get interactive elements
browseros-cli ss -o test-state.png         # visual snapshot
browseros-cli eval "document.querySelectorAll('.error').length"

Common Mistakes

MistakeFix
--------------
Using CSS selectors (fill --selector "input[type=email]")Always snap first, then use element IDs (fill 10 "text")
Reusing element IDs after a click or navigationIDs are invalidated by DOM changes — snap again
Using eval to extract textUse text or text --selector instead — lower tokens, structured output
Forgetting to close tabsAlways close when done to avoid resource leaks
Using nav when you want a new tabnav replaces the current tab. Use open for a new tab
Using open when you want to stay in the same tabopen creates a new tab. Use nav to navigate in place
Taking screenshots for content extractionUse text for content — screenshots burn tokens and need vision
Using dialog --accept (flag syntax)Correct syntax is dialog accept or dialog dismiss (positional arg)

Deep-Dive Documentation

ReferenceDescription
------------------------
references/cli-commands.mdFull command reference with all flags

Links

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 05:33 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,243 📥 271,500
ai-agent

self-improving agent

pskoett
记录自身发现以实现自我改进的技能
★ 4,124 📥 864,750
ai-agent

Agent Browser

rez0
用于 AI 代理的浏览器自动化 CLI。当用户需要与网站交互(包括浏览页面、填写表单、点击按钮、截图等)时使用。
★ 845 📥 326,363