Skip to main content

截图

🌐 Screenshots

browser_take_screenshot

捕捉视口、特定元素或整个可滚动页面。截图是用来看,不是用来操作的 — 使用 browser_snapshot 获取可交互的引用。

🌐 Capture the viewport, a specific element, or the full scrollable page. Screenshots are for looking at, not for acting on — use browser_snapshot to get refs to interact with.

参数类型是否必填描述
target字符串元素引用或选择器,用于截图单个元素
type字符串pngjpegwebp。如果未设置,则根据文件名后缀推断,否则为 png
filename字符串要保存的文件。相对路径会以工作区根目录为基准解析。默认保存到输出目录中的 page-{timestamp}.{ext}
fullPage布尔值捕获整个可滚动页面而不是视口。不能与 target 一起使用
scale字符串css(默认)用于 CSS 像素尺寸,或使用设备像素比生成高分辨率图片的 device

当省略 filename 时,图片也会在工具响应中直接返回,所以 LLM 可以看到它。传入 --image-responses=omit 可以让响应中不包含图片。

🌐 When filename is omitted the image is also returned inline in the tool response, so the LLM can see it. Pass --image-responses=omit to keep images out of the response.

页面截图

🌐 Page screenshot

You: Take a screenshot of the current page.

→ browser_take_screenshot
- [Screenshot of viewport](page-2026-09-04T10-15-00-000Z.png)

元素截图

🌐 Element screenshot

You: Take a screenshot of just the login form.

→ browser_take_screenshot { target: "e12" }
- [Screenshot of Login form](element-2026-09-04T10-15-04-000Z.png)

整页截图

🌐 Full-page screenshot

You: Take a full-page screenshot including content below the fold.

→ browser_take_screenshot { fullPage: true, filename: "homepage.png" }
- [Screenshot of full page](homepage.png)

高清截图

🌐 High-resolution screenshot

→ browser_take_screenshot { scale: "device", type: "webp" }

何时使用截图

🌐 When to use screenshots

截图补充了辅助功能快照:

🌐 Screenshots complement accessibility snapshots:

用例最佳工具
与元素交互辅助功能快照(引用)
验证视觉布局截图
画布/图表内容截图
记录错误截图
了解页面结构辅助功能快照
阅读文本内容辅助功能快照