运行时依赖
版本
Commands
安装命令
点击复制技能文档
Browser 自动化 with 代理-browser 安装ation npm recommended npm 安装 -g 代理-browser 代理-browser 安装 代理-browser 安装 --with-deps
From Source git clone https://github.com/vercel-labs/代理-browser cd 代理-browser pnpm 安装 pnpm build 代理-browser 安装
Quick 启动 代理-browser open # Navigate to page 代理-browser snapshot -i # 获取 interactive elements with refs 代理-browser 命令行工具ck @e1 # 命令行工具ck element by ref 代理-browser fill @e2 "text" # Fill 输入 by ref 代理-browser close # Close browser
Core 工作流 Navigate: 代理-browser open Snapshot: 代理-browser snapshot -i (returns elements with refs like @e1, @e2) Interact using refs from the snapshot Re-snapshot after navigation or 签名ificant DOM changes Commands Navigation 代理-browser open # Navigate to URL 代理-browser back # Go back 代理-browser forward # Go forward 代理-browser reload # Reload page 代理-browser close # Close browser
Snapshot (page analysis) 代理-browser snapshot # Full 访问ibility tree 代理-browser snapshot -i # Interactive elements only (recommended) 代理-browser snapshot -c # Compact 输出 代理-browser snapshot -d 3 # Limit depth to 3 代理-browser snapshot -s "#mAIn" # Scope to CSS selector
Interactions (use @refs from snapshot) 代理-browser 命令行工具ck @e1 # 命令行工具ck 代理-browser dbl命令行工具ck @e1 # Double-命令行工具ck 代理-browser focus @e1 # Focus element 代理-browser fill @e2 "text" # Clear and type 代理-browser type @e2 "text" # Type without clearing 代理-browser press Enter # Press key 代理-browser press Control+a # Key combination 代理-browser keydown Shift # Hold key down 代理-browser keyup Shift # Release key 代理-browser hover @e1 # Hover 代理-browser 检查 @e1 # 检查 检查box 代理-browser un检查 @e1 # Un检查 检查box 代理-browser select @e1 "value" # Select dropdown 代理-browser scroll down 500 # Scroll page 代理-browser scrollintoview @e1 # Scroll element into view 代理-browser drag @e1 @e2 # Drag and drop 代理-browser 上传 @e1 file.pdf # 上传 files
获取 in格式化ion 代理-browser 获取 text @e1 # 获取 element text 代理-browser 获取 html @e1 # 获取 innerHTML 代理-browser 获取 value @e1 # 获取 输入 value 代理-browser 获取 attr @e1 href # 获取 attribute 代理-browser 获取 title # 获取 page title 代理-browser 获取 url # 获取 current URL 代理-browser 获取 count ".item" # Count matching elements 代理-browser 获取 box @e1 # 获取 bounding box
检查 状态 代理-browser is visible @e1 # 检查 if visible 代理-browser is enabled @e1 # 检查 if enabled 代理-browser is 检查ed @e1 # 检查 if 检查ed
Screenshots & PDF 代理-browser screenshot # Screenshot to stdout 代理-browser screenshot path.png # Save to file 代理-browser screenshot --full # Full page 代理-browser pdf 输出.pdf # Save as PDF
Video recording 代理-browser record 启动 ./demo.网页m # 启动 recording (uses current URL + 状态) 代理-browser 命令行工具ck @e1 # Perform actions 代理-browser record 停止 # 停止 and save video 代理-browser record re启动 ./take2.网页m # 停止 current + 启动 new recording
Recording 创建s a fresh 上下文 but preserves cookies/storage from your 会话. If no URL is provided, it automatically returns to your current page. For smooth demos, explore first, then 启动 recording.
WAIt 代理-browser wAIt @e1 # WAIt for element 代理-browser wAIt 2000 # WAIt milliseconds 代理-browser wAIt --text "成功" # WAIt for text 代理-browser wAIt --url "/仪表盘" # WAIt for URL pattern 代理-browser wAIt --load networkidle # WAIt for network idle 代理-browser wAIt --fn "window.ready" # WAIt for JS condition
Mouse control 代理-browser mouse move 100 200 # Move mouse 代理-browser mouse down left # Press button 代理-browser mouse up left # Release button 代理-browser mouse wheel 100 # Scroll wheel
Semantic locators (alternative to refs) 代理-browser find 角色 button 命令行工具ck --name "Submit" 代理-browser find text "签名 In" 命令行工具ck 代理-browser find label "EmAIl" fill "user@test.com" 代理-browser find first ".item" 命令行工具ck 代理-browser find nth 2 "a" text
Browser 设置tings 代理-browser 设置 viewport 1920 1080 # 设置 viewport size 代理-browser 设置 device "iPhone 14" # Emulate device 代理-browser 设置 geo 37.7749 -122.4194 # 设置 geolocation 代理-browser 设置 offline on # Toggle offline mode 代理-browser 设置 headers '{"X-Key":"v"}' # Extra HTTP headers 代理-browser 设置 凭证s user pass # HTTP basic auth 代理-browser 设置 media dark # Emulate color scheme
Cookies & Storage 代理-browser cookies # 获取 all cooki