> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/automate-zh/cao-zuo-zhi-nan/javascript/screenshot.md).

# 截图

截图是指命令浏览器自动捕捉当前网页界面的行为。这个行为非常有用，可以帮助您存储已完成任务的证据，捕捉二维码，或在脚本遇到故障时保存错误界面以便于调试（Debug）。

#### 配置参数：

* 输出路径：您希望用于存储截图的计算机上目录的绝对路径（例如：`D:\GPM_Automate\Screenshots`）。
* 文件名：您希望设置的图像文件的名称（例如：`success_evidence.png`）。您可以在这里传递动态变量，如账户号码或时间，以避免后面的文件覆盖前面的文件。
* 全页：如果您希望系统滚动捕捉整个网页的内容，请勾选此项。如果不勾选，系统将仅捕捉您当前所看到的屏幕框架（当前显示区域）。
* 输出变量：GPM Automate用于保存成功截图后生成的图像文件的绝对路径的变量名称。

#### 实际示例：自动保存成功发布后的确认图像

当您编写自动发布销售或互动服务的脚本时。在系统显示“发布成功”消息后，您希望截图以便为客户做报告：

* 配置方式：
  * 输出路径：`D:\MMO_Project\Report`
  * 文件名：`account01_done.png`
  * 全页：*勾选*（以便捕捉到发布内容的全部信息）。
  * 输出变量：`savedImagePath`
* 结果：GPM Automate将捕捉整个网页，将其打包成图像文件存储到您要求的目录中，并将该文件的路径保存到变量`$savedImagePath`中，以便您在后续步骤中用于通过Telegram/Discord发送报告。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gpmautomate.com/automate-zh/cao-zuo-zhi-nan/javascript/screenshot.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
