browser_screenshot
Capture screenshots of web pages or elements to validate rendering, record bug evidence, and support visual comparisons. Sensitive inputs are automatically redacted.
Instructions
Take a screenshot of the current page and save it to the MCP artifacts directory. Sensitive inputs (password, token, apiKey) are auto-redacted by default.
中文详情:
用途:对真实浏览器当前页面截图并保存为 PNG 文件到 screenshots 目录
何时使用:验证页面渲染结果时;记录 bug 证据时;视觉对比前截取基线/实际图时;流程关键节点留证时
输出:{ ok: boolean, path: string, name: string, timestamp: string } — path 为截图绝对路径
参数:
name (string, 可选):截图文件名(不含扩展名),默认使用时间戳
redactSelectors (array, 可选):需要额外遮挡的 CSS 选择器列表,默认已遮挡 [type=password]、[name*=token]、[name*=apiKey]
错误:浏览器未启动抛出 'Browser not launched';截图失败抛出 'Screenshot failed'
示例:{"name":"login-page","redactSelectors":[".credit-card"]}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | 截图模式:page(默认,整页截图)/ element(元素截图,等价于已废弃的 browser_screenshot_element,需指定 selector) | page |
| name | No | 截图文件名,不含扩展名 | |
| padding | No | 截图区域周围的 padding,单位像素,默认 0(mode=element 时使用) | |
| selector | No | 目标元素的 CSS 选择器(mode=element 时必填) | |
| redactSelectors | No | 需要额外遮挡的 CSS 选择器列表(mode=page 时使用) |