> 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).

# Screenshot

截图是指命令浏览器自动捕捉当前网页界面的操作。此操作非常有用，可以用来存储已完成任务的证据、捕捉二维码，或在脚本出现故障时保存错误界面以便于调试。

🎥 查看更多教程视频：[在这里](https://youtu.be/c3gYFS7IIr4)。

#### 配置参数：

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

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

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

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

<figure><img src="/files/mgPYV5ffZBeFLuge2qMU" alt=""><figcaption></figcaption></figure>


---

# 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.
