browse
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBrowse Browser Automation
Browse 浏览器自动化
Control Chrome browser via CLI.
通过CLI控制Chrome浏览器。
CLI Quick Reference
CLI快速参考
bash
browse --help # Full help
browse <group> # Group help (tab, scroll, page, wait, dialog, emulate, form, perf)
browse --list # All 60+ tools
browse --find <term> # Search toolsbash
browse --help # Full help
browse <group> # Group help (tab, scroll, page, wait, dialog, emulate, form, perf)
browse --list # All 60+ tools
browse --find <term> # Search toolsCore Workflow
核心工作流
bash
undefinedbash
undefined1. Open new tab with URL
1. Open new tab with URL
browse tab.new "https://example.com"
browse tab.new "https://example.com"
2. Read page to get element refs (currently visible)
2. Read page to get element refs (currently visible)
browse page.read
browse page.read
3. Click by ref or coordinates
3. Click by ref or coordinates
browse click --ref "e1"
browse click --x 100 --y 200
browse click --ref "e1"
browse click --x 100 --y 200
4. Type text
4. Type text
browse type --text "hello"
browse type --text "hello"
5. Screenshot
5. Screenshot
browse screenshot --output /tmp/shot.png
undefinedbrowse screenshot --output /tmp/shot.png
undefinedNavigation
页面导航
bash
undefinedbash
undefinedOpen new tab (preferred for new pages)
Open new tab (preferred for new pages)
browse tab.new "https://example.com"
browse tab.new "https://example.com"
Navigate in current tab (only when tab is already open)
Navigate in current tab (only when tab is already open)
browse navigate "https://other-page.com"
**Use `tab.new`** to open a new page or start a task.
**Use `navigate`** only to change URL in an already open tab.browse navigate "https://other-page.com"
**使用`tab.new`** 打开新页面或启动任务。
**使用`navigate`** 仅用于在已打开的标签页中更改URL。Tab Management
标签页管理
bash
browse tab.list
browse tab.new "https://google.com"
browse tab.switch 12345
browse tab.close 12345bash
browse tab.list
browse tab.new "https://google.com"
browse tab.switch 12345
browse tab.close 12345Named tabs (aliases)
Named tabs (aliases)
browse tab.name myapp # Name current tab
browse tab.switch myapp # Switch by name
browse tab.named # List named tabs
undefinedbrowse tab.name myapp # Name current tab
browse tab.switch myapp # Switch by name
browse tab.named # List named tabs
undefinedWindow Management
窗口管理
bash
browse window.list # List all windows
browse window.new # New window
browse window.new --url "https://example.com" # New window with URL
browse window.new --incognito # New incognito window
browse window.focus 12345 # Focus window by ID
browse window.close 12345 # Close window
browse window.resize --width 1920 --height 1080 # Resize current windowbash
browse window.list # List all windows
browse window.new # New window
browse window.new --url "https://example.com" # New window with URL
browse window.new --incognito # New incognito window
browse window.focus 12345 # Focus window by ID
browse window.close 12345 # Close window
browse window.resize --width 1920 --height 1080 # Resize current windowInput Methods
输入方式
bash
undefinedbash
undefinedCDP method (real events) - default
CDP method (real events) - default
browse type --text "hello"
browse click --x 100 --y 200
browse type --text "hello"
browse click --x 100 --y 200
JS method (DOM manipulation) - for contenteditable
JS method (DOM manipulation) - for contenteditable
browse type --text "hello" --selector "#input" --method js
browse type --text "hello" --selector "#input" --method js
Keys
Keys
browse key Enter
browse key "cmd+a"
browse key.repeat --key Tab --count 5 # Repeat key presses
undefinedbrowse key Enter
browse key "cmd+a"
browse key.repeat --key Tab --count 5 # Repeat key presses
undefinedPage Inspection
页面检查
bash
browse page.read # Accessibility tree with refs (viewport only)
browse page.read --ref e5 # Get specific element details
browse page.read --all # All elements (may hit 50K char limit on large pages)
browse page.text # Full page text content (no limit)
browse page.state # Modals, loading state, scroll infoWhen to use which:
- - Get full page text content. No size limit. Best for reading/understanding page content.
page.text - - Get element refs for visible viewport. Use when you need to interact (click, type).
page.read - - All elements with refs. Can fail on large pages (50K char limit).
page.read --all
Note: returns only elements in the visible viewport. Refs remain valid for off-screen elements - you can still even after scrolling. Use to bring an element into view.
page.readclick e5scroll.to --ref e5bash
browse page.read # Accessibility tree with refs (viewport only)
browse page.read --ref e5 # Get specific element details
browse page.read --all # All elements (may hit 50K char limit on large pages)
browse page.text # Full page text content (no limit)
browse page.state # Modals, loading state, scroll info适用场景对比:
- - 获取完整页面文本内容,无大小限制,最适合读取或理解页面内容。
page.text - - 获取可见视口中的元素引用,用于交互操作(点击、输入)场景。
page.read - - 获取所有元素的引用,但在大型页面上可能因50K字符限制而失败。
page.read --all
注意: 仅返回可见视口中的元素,但引用对屏幕外元素依然有效——即使元素滚出视野,你仍可执行操作。可使用将元素滚动到视野内。
page.readclick e5scroll.to --ref e5Scrolling
页面滚动
bash
browse scroll down # Scroll down (default amount)
browse scroll up # Scroll up
browse scroll down --amount 5 # Scroll down more (1-10)
browse scroll.bottom # Scroll to bottom of page
browse scroll.top # Scroll to top of page
browse scroll.to --ref e5 # Scroll element into view
browse scroll.info # Get scroll positionbash
browse scroll down # Scroll down (default amount)
browse scroll up # Scroll up
browse scroll down --amount 5 # Scroll down more (1-10)
browse scroll.bottom # Scroll to bottom of page
browse scroll.top # Scroll to top of page
browse scroll.to --ref e5 # Scroll element into view
browse scroll.info # Get scroll positionWaiting
等待操作
bash
browse wait 2 # Wait 2 seconds
browse wait.element ".loaded" # Wait for element
browse wait.network # Wait for network idle
browse wait.url "/success" # Wait for URL pattern
browse wait.dom --stable 100 # Wait for DOM stability
browse wait.load # Wait for page load completebash
browse wait 2 # Wait 2 seconds
browse wait.element ".loaded" # Wait for element
browse wait.network # Wait for network idle
browse wait.url "/success" # Wait for URL pattern
browse wait.dom --stable 100 # Wait for DOM stability
browse wait.load # Wait for page load completeDialog Handling
对话框处理
bash
browse dialog.info # Get current dialog type/message
browse dialog.accept # Accept (OK)
browse dialog.accept --text "response" # Accept prompt with text
browse dialog.dismiss # Dismiss (Cancel)bash
browse dialog.info # Get current dialog type/message
browse dialog.accept # Accept (OK)
browse dialog.accept --text "response" # Accept prompt with text
browse dialog.dismiss # Dismiss (Cancel)Device/Network Emulation
设备/网络模拟
bash
undefinedbash
undefinedNetwork throttling
Network throttling
browse emulate.network slow-3g # Presets: slow-3g, fast-3g, 4g, offline
browse emulate.network reset # Disable throttling
browse emulate.network slow-3g # Presets: slow-3g, fast-3g, 4g, offline
browse emulate.network reset # Disable throttling
CPU throttling
CPU throttling
browse emulate.cpu 4 # 4x slower
browse emulate.cpu 1 # Reset
browse emulate.cpu 4 # 4x slower
browse emulate.cpu 1 # Reset
Device emulation
Device emulation
browse emulate.device "iPhone 14"
browse emulate.device --list # List available devices
browse emulate.device "iPhone 14"
browse emulate.device --list # List available devices
Geolocation
Geolocation
browse emulate.geo --lat 37.7749 --lon -122.4194
browse emulate.geo --clear
undefinedbrowse emulate.geo --lat 37.7749 --lon -122.4194
browse emulate.geo --clear
undefinedForm Automation
表单自动化
bash
browse page.read # Get element refs firstbash
browse page.read # Get element refs firstFill by ref
Fill by ref
browse form.fill --data '[{"ref":"e1","value":"John"},{"ref":"e2","value":"john@example.com"}]'
browse form.fill --data '[{"ref":"e1","value":"John"},{"ref":"e2","value":"john@example.com"}]'
Checkboxes: true/false
Checkboxes: true/false
browse form.fill --data '[{"ref":"e7","value":true}]'
undefinedbrowse form.fill --data '[{"ref":"e7","value":true}]'
undefinedFile Upload
文件上传
bash
browse upload --ref e5 --files "/path/to/file.txt"
browse upload --ref e5 --files "/path/file1.txt,/path/file2.txt"bash
browse upload --ref e5 --files "/path/to/file.txt"
browse upload --ref e5 --files "/path/file1.txt,/path/file2.txt"Network Inspection
网络检查
bash
browse network # List captured requests
browse network --stream # Real-time network events
browse network.body --id "req-123" # Get response body
browse network.clear # Clear captured requestsbash
browse network # List captured requests
browse network --stream # Real-time network events
browse network.body --id "req-123" # Get response body
browse network.clear # Clear captured requestsConsole
控制台
bash
browse console # Get console messages
browse console --stream # Real-time console
browse console --stream --level error # Errors onlybash
browse console # Get console messages
browse console --stream # Real-time console
browse console --stream --level error # Errors onlyJavaScript Execution
JavaScript执行
bash
browse js "return document.title"
browse js "document.querySelector('.btn').click()"bash
browse js "return document.title"
browse js "document.querySelector('.btn').click()"Iframe Handling
Iframe处理
bash
browse frame.list # List frames with IDs
browse frame.js --id "FRAME_ID" --code "return document.title"bash
browse frame.list # List frames with IDs
browse frame.js --id "FRAME_ID" --code "return document.title"Performance
性能监控
bash
browse perf.metrics # Current metrics snapshot
browse perf.start # Start trace
browse perf.stop # Stop and get resultsbash
browse perf.metrics # Current metrics snapshot
browse perf.start # Start trace
browse perf.stop # Stop and get resultsScreenshots
截图
bash
browse screenshot # To stdout (base64)
browse screenshot --output /tmp/shot.png # Save to file
browse screenshot --selector ".card" # Element only
browse screenshot --full-page # Full page scroll capturebash
browse screenshot # To stdout (base64)
browse screenshot --output /tmp/shot.png # Save to file
browse screenshot --selector ".card" # Element only
browse screenshot --full-page # Full page scroll captureCookies & Storage
Cookie与存储
bash
browse cookies # List cookies for current page
browse cookies --domain .google.com
browse cookie.set --name "token" --value "abc123"
browse cookie.delete --name "token"bash
browse cookies # List cookies for current page
browse cookies --domain .google.com
browse cookie.set --name "token" --value "abc123"
browse cookie.delete --name "token"History & Bookmarks
历史记录与书签
bash
browse history --query "github" --max 20
browse bookmarks --query "docs"
browse bookmark.add --url "https://..." --title "My Bookmark"bash
browse history --query "github" --max 20
browse bookmarks --query "docs"
browse bookmark.add --url "https://..." --title "My Bookmark"Health Checks & Smoke Tests
健康检查与冒烟测试
bash
browse health --url "http://localhost:3000"
browse smoke --urls "http://localhost:3000" "http://localhost:3000/about"
browse smoke --urls "..." --screenshot /tmp/smokebash
browse health --url "http://localhost:3000"
browse smoke --urls "http://localhost:3000" "http://localhost:3000/about"
browse smoke --urls "..." --screenshot /tmp/smokeError Diagnostics
错误诊断
bash
undefinedbash
undefinedAuto-capture screenshot + console on failure
Auto-capture screenshot + console on failure
browse wait.element ".missing" --auto-capture --timeout 2000
browse wait.element ".missing" --auto-capture --timeout 2000
Saves to /tmp/browse-error-*.png
Saves to /tmp/browse-error-*.png
undefinedundefinedCommon Options
通用选项
bash
--tab-id <id> # Target specific tab
--json # Raw JSON output
--auto-capture # Screenshot + console on error
--timeout <ms> # Override default timeoutbash
--tab-id <id> # Target specific tab
--json # Raw JSON output
--auto-capture # Screenshot + console on error
--timeout <ms> # Override default timeoutTips
使用技巧
- First CDP operation is slow (~5-8s) - debugger attachment overhead, subsequent calls fast
- Use refs from page.read for reliable element targeting over CSS selectors
- JS method for contenteditable - Modern editors (Notion, etc.) need
--method js - Named tabs for multi-step tasks - then
tab.name apptab.switch app - Auto-capture for debugging - saves diagnostics on failure
--auto-capture
- 首次CDP操作速度较慢(约5-8秒)- 这是调试器附加的overhead导致,后续调用会显著加快
- 优先使用page.read返回的refs 定位元素,比CSS选择器更可靠
- contenteditable元素使用JS方式 - 现代编辑器(如Notion等)需要添加参数
--method js - 多步骤任务使用命名标签页 - 先执行命名,再用
tab.name app快速切换tab.switch app - 调试时启用自动捕获 - 参数会在执行失败时自动保存截图和控制台信息,便于诊断
--auto-capture