> 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/active-tab.md).

# Active tab

此操作可帮助工具切换到浏览器中打开的另一个标签页。

帮助您轻松实现多任务处理。例如:您正在标签页 A 中获取数据,然后使用此命令切换到标签页 B 并将数据粘贴到那里。

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

### 重要提示

切换后,工具接下来的所有操作(点击、输入数据、抓取数据)都只会在这个新选中的标签页上运行。

### 配置参数

* Type: 选择系统用来确定需要切换的标签页的方式:
  * By Index: 根据位置序号切换标签页(从左到右计算,从数字 0 开始)。
  * By Prefix URL: 根据地址链接(URL)的开头部分切换标签页。系统会扫描所有正在打开的标签页,哪个标签页的 URL 以您填写的字符串开头,该标签页就会被激活。

#### 💡 用户建议

使用切换标签页功能时,您应该优先选择 **By Prefix URL** 方式。

原因是标签页的顺序(Index)可能会因 Remote Port 返回机制而无规律地变化,导致使用序号可能不准确,从而中断脚本运行。使用 Prefix URL 可以确保工具始终找到所需的正确标签页,无论其在浏览器上的位置如何。

*小贴士:当浏览器弹出关联的弹窗窗口(如 Google 登录窗口、MetaMask 钱包等)后,您只需调用索引为 0 的 Active Tab 操作即可快速返回主浏览器窗口。*

<figure><img src="/files/0AoJUXmy73hj6VTkTDL7" 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/action-shi-yong-zhi-nan/navigation/active-tab.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.
