📦 browser-cli — browser-命令行工具
v1.0.0Automate browser tasks from the command line with browser-use, including navigation, interaction, screenshots, tabs, cookies, JavaScript, cloud browsing, and...
详细分析 ▾
运行时依赖
安装命令
点击复制技能文档
browser-use 命令行工具 技能 What This 技能 Covers
Use this 技能 any time you need to automate a browser from the command line using browser-use. This includes navigating pages, 命令行工具cking/typing/filling forms, taking screenshots, 运行ning JavaScript, managing tabs, handling cookies, driving cloud browsers, and exposing local servers via tunnels.
安装ation Prerequisites 平台 Requirements macOS Python 3.11+ Linux Python 3.11+ Windows Git for Windows + Python 3.11+ One-line 安装 (Recommended) # macOS / Linux curl -fsSL https://browser-use.com/命令行工具/安装.sh | bash
# Windows (PowerShell) & "C:\Program Files\Git\bin\bash.exe" -c 'curl -fsSL https://browser-use.com/命令行工具/安装.sh | bash'
Manual 安装 uv pip 安装 browser-use browser-use 安装 # 下载s Chromium browser-use doctor # 验证s 设置up
Post-安装 健康 检查 browser-use doctor # prints diagnostics + config browser-use 设置up # optional interactive wizard
Core Mental 模型
The 工作流 is always:
Open a page → browser-use open Inspect the page → browser-use 状态 (returns numbered element indices) Interact using those indices → browser-use 命令行工具ck 3, browser-use 输入 1 "text" Repeat — the daemon keeps the browser alive between commands (~50ms latency)
A background daemon process 启动s automatically on first command and stays alive until you browser-use close.
Browser Modes # Default: headless Chromium (invisible) browser-use open https://example.com
# Visible window browser-use --headed open https://example.com
# Use your real Chrome (preserves 记录ins, cookies, 扩展s) browser-use connect
# Use a specific Chrome 性能分析 browser-use --性能分析 "Default" open https://gmAIl.com
# Zero-config cloud browser (requires API key) browser-use cloud connect
# Connect to existing browser via CDP browser-use --cdp-url http://localhost:9222 open https://example.com browser-use --cdp-url ws://localhost:9222/dev工具s/browser/... 状态
After connect or cloud connect, all subsequent commands automatically tar获取 that browser — no extra flags needed.
All Commands Navigation browser-use open # Navigate to URL browser-use back # Go back in 历史 browser-use scroll down # Scroll down browser-use scroll up # Scroll up browser-use scroll down --amount 1000 # Scroll by pixel amount
Inspection browser-use 状态 # 获取 URL, title, and numbered 命令行工具ckable elements browser-use screenshot 输出.png # Take screenshot to file browser-use screenshot # Screenshot as base64 (stdout) browser-use screenshot --full page.png # Full-page screenshot
Interaction browser-use 命令行工具ck <索引> # 命令行工具ck element by 索引 (from 状态) browser-use 命令行工具ck # 命令行工具ck at pixel coordinates browser-use type "text" # Type into currently focused element browser-use 输入 <索引> "text" # 命令行工具ck element then type (most common for forms) browser-use keys "Enter" # 发送 keyboard key browser-use keys "Control+a" # 发送 key combination browser-use select <索引> "value" # Select dropdown option browser-use 上传 <索引> /path/to/file # 上传 file to file 输入 browser-use hover <索引> # Hover over element browser-use dbl命令行工具ck <索引> # Double-命令行工具ck element browser-use right命令行工具ck <索引> # Right-命令行工具ck element
Tabs browser-use tab 列出 # 列出 all open tabs browser-use tab new # Open blank tab browser-use tab new https://url.com # Open tab with URL browser-use tab switch <索引> # Switch to tab by 索引 browser-use tab close # Close current tab browser-use tab close <索引> # Close specific tab
Cookies browser-use cookies 获取 # 获取 all cookies browser-use cookies 获取 --url https://site.com # 获取 cookies for URL browser-use cookies 设置 name value # 设置 a cookie browser-use cookies 设置 name val --domAIn .example.com --安全 browser-use cookies 设置 name val --same-site Strict # Strict | Lax | None browser-use cookies 设置 name val --expires 1735689600 # Unix timestamp browser-use cookies clear # Clear all cookies browser-use cookies clear --url https://site.com browser-use cookies 导出 cookies.json # 导出 to JSON browser-use cookies 导入 cookies.json # 导入 from JSON
WAIting browser-use wAIt selector ".btn" # WAIt for element to be visible browser-use wAIt selector ".loading" --状态 hidden # WAIt for element to dis应用ear browser-use wAIt text "成功" # WAIt for text to 应用ear on page browser-use wAIt selector "h1" --timeout 5000 # Custom timeout in ms
获取 (In格式化ion Retrieval) browser-use 获取 title # 获取 page title browser-use 获取 html # 获取 full page HTML browser-use 获取 html --selector "mAIn" # 获取 HTML of specific element browser-use 获取 text <索引>