> 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-en/action-guides/switch/switch-to-popup.md).

# Switch to popup

Switch to popup is the action that instructs the script to transfer control from the current browser window to a newly opened child window (Popup Window).

#### The difference between Iframe and Popup:

* Iframe: Is a "frame" embedded within the same tab of the web page.
* Popup: Is a completely new window detached from the old tab, operating independently (with its own title bar and maximize/minimize/close buttons).

#### Configuration parameters:

* Popup Title: The title of the popup window you want to switch to. The system applies a relative search mechanism (as long as the popup title contains the phrase you enter, the system will automatically recognize and jump to it).

#### Real-world example: Handling the Google login window after clicking "Continue with Google"

Continue the processing flow on Pinterest from the previous step. After you switch to the Iframe and click the *Continue with Google* button, a small independent window (Popup) will pop up outside the screen to ask you to enter your Gmail and Google Password.

At this point, the original Pinterest browser will be dimmed, and all subsequent actions must be performed in this new window. You configure as follows:

* Step 1 (Activate Popup opening): Use the click command on the *Continue with Google* button (as done in the Iframe lesson).
* Step 2 (Wait for Popup to appear - If needed): You can use the Wait popup command or a short Delay of about 1-2 seconds for the window to load.
* Step 3 (Check if Popup exists): You can use the Has popup command. If the popup exists, the returned result is True.
* Step 3 (Switch to Popup): Drag the Switch to popup action into the flow.
  * Popup Title: Enter the text `Google Accounts` *(Since the full title of this window is often very long like "Sign in - Google Accounts", you only need to enter this distinctive phrase for the system to match)*.
* Step 4 (Input interaction): After this command, control is fully in the new window. You proceed to use Key press commands to enter the account, password, and click Next as usual.

> 💡 Tip to return: After you complete the login in the Popup window, the Google system will automatically check and close this window. To continue controlling the original Pinterest page, you just need to use the Active tab command or return to the main tab to continue running the subsequent data scraping actions.


---

# 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-en/action-guides/switch/switch-to-popup.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.
