chrome-devtools
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCore Concepts
核心概念
Browser lifecycle: Browser starts automatically on first tool call using a persistent Chrome profile. Configure via CLI args in the MCP server configuration: .
npx chrome-devtools-mcp@latest --helpPage selection: Tools operate on the currently selected page. Use to see available pages, then to switch context.
list_pagesselect_pageElement interaction: Use to get page structure with element s. Each element has a unique for interaction. If an element isn't found, take a fresh snapshot - the element may have been removed or the page changed.
take_snapshotuiduid浏览器生命周期:首次调用工具时会自动启动浏览器,使用持久化Chrome配置文件。可在MCP服务器配置中通过CLI参数进行配置:。
npx chrome-devtools-mcp@latest --help页面选择:工具作用于当前选中的页面。使用查看可用页面,然后使用切换上下文。
list_pagesselect_page元素交互:使用获取包含元素的页面结构。每个元素都有唯一的用于交互。如果未找到元素,请重新获取快照——该元素可能已被移除或页面已发生变化。
take_snapshotuiduidWorkflow Patterns
工作流模式
Before interacting with a page
与页面交互前
- Navigate: or
navigate_pagenew_page - Wait: to ensure content is loaded if you know what you look for.
wait_for - Snapshot: to understand page structure
take_snapshot - Interact: Use element s from snapshot for
uid,click, etc.fill
- 导航:使用或
navigate_pagenew_page - 等待:如果明确目标内容,使用确保内容加载完成。
wait_for - 快照:使用了解页面结构
take_snapshot - 交互:使用快照中的元素执行
uid、click等操作。fill
Efficient data retrieval
高效数据获取
- Use parameter for large outputs (screenshots, snapshots, traces)
filePath - Use pagination (,
pageIdx) and filtering (pageSize) to minimize datatypes - Set on input actions unless you need updated page state
includeSnapshot: false
- 对于大体积输出(截图、快照、追踪日志),使用参数
filePath - 使用分页(、
pageIdx)和过滤(pageSize)来减少数据量types - 除非需要更新页面状态,否则在输入操作中设置
includeSnapshot: false
Tool selection
工具选择
- Automation/interaction: (text-based, faster, better for automation)
take_snapshot - Visual inspection: (when user needs to see visual state)
take_screenshot - Additional details: for data not in accessibility tree
evaluate_script
- 自动化/交互:(基于文本,速度更快,更适合自动化场景)
take_snapshot - 视觉检查:(当用户需要查看视觉状态时使用)
take_screenshot - 额外信息获取:使用获取无障碍树中未包含的数据
evaluate_script
Parallel execution
并行执行
You can send multiple tool calls in parallel, but maintain correct order: navigate → wait → snapshot → interact.
你可以并行发送多个工具调用,但需保持正确顺序:导航 → 等待 → 快照 → 交互。
Troubleshooting
故障排查
If is insufficient, guide users to use Chrome DevTools UI:
chrome-devtools-mcp如果功能不足,引导用户使用Chrome DevTools UI:
chrome-devtools-mcp