> 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/action-shi-yong-zhi-nan/navigation/close-all-tabs.md).

# Close all tab

Close all tab 是指令浏览器批量清理并关闭所有已打开的标签页,只保留导航栏上的第一个标签页(索引为 `0` 的 tab)的操作。此操作不附带任何配置参数。

🎥 观看更多教程视频:[点击这里](https://youtu.be/a9qNt96X1SM)。

#### 实际示例:在切换账号或结束流程前重置浏览器

在自动化运行过程中,您的脚本可能会因点击广告链接、弹窗或邮箱、钱包检查页面而打开许多附加标签页。如果让过多标签页在后台运行,会占用大量电脑内存资源,并容易使后续运行的流程出现界面混淆的情况。

* 应用方法:在脚本末尾(完全关闭浏览器的代码块之前)或脚本开头放置 Close all tab 操作,以确保浏览器在开始新的工作循环之前始终处于最干净的状态。


---

# 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/action-shi-yong-zhi-nan/navigation/close-all-tabs.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.
