> For the complete documentation index, see [llms.txt](https://help.autify.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.autify.com/nocode-web/en/autify-university/foundation/creating-a-scenario/open-switch-window-step.md). Agents can also search and read this documentation through its [MCP server](https://help.autify.com/~gitbook/mcp).

# Steps to open and switch windows

## Open a new window

To open a new window and go to a specific URL, you need to add an **Open Window** step.

![](https://1964297753-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVdZPTgwISYb3LhjgKnw6%2Fuploads%2Fgit-blob-10bb625ff8b36908e39b102ccb998304663d87da%2Fen-window-open.png?alt=media)

### How to add an Open Window step

There are two ways to add an **Open Window** step:

* While recording, [add a Go To URL step](https://help.autify.com/nocode-web/en/autify-university/foundation/creating-a-scenario/go-to-url-button.md) using the Autify Recorder (select the *Open in new window* option).
* On the Scenario Edit page, click ***\[Insert Step]*** and select ***\[Open Window Step]***.

### Return to the original window

To return to the original window after recording in the new window, perform the action that goes back to the original window and then perform any action in that window. This will add either the [Switch To Initial Window](#switch-to-initial-window) step or the [Switch To Step N's Window](#switch-to-step-n-s-window) step.

![](https://1964297753-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVdZPTgwISYb3LhjgKnw6%2Fuploads%2Fgit-blob-9ff8d71faa2a00844318fdc86b529ab2870909d3%2Fen-switch-to-initial-window.png?alt=media)

## Switching tabs in the same window

If you want to open or switch tabs in the same window, you need to add a **Switch To Window** step.

### How to add a Switch To Window step

You can't add a **Switch To Window** step from the Scenario Edit Page, so you must create it during recording. The step is automatically added during recording when you click on the element that triggers a new tab to open or perform an action that switches tabs.

There are three types of step that can switch tabs.

#### Switch To New Window

This step is created when a new tab is opened by clicking a link or button.

![](https://1964297753-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVdZPTgwISYb3LhjgKnw6%2Fuploads%2Fgit-blob-9a8a73c7777b7e0bbb1348e3d385774dbc180bcd%2Fen-switch-to-new-window.png?alt=media)

#### Switch To Initial Window <a href="#switch-to-initial-window" id="switch-to-initial-window"></a>

This step is created when you switch from the current tab to the tab opened in step 1. This step is also created when you switch from the current window to the window you opened in step 1.

![](https://1964297753-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVdZPTgwISYb3LhjgKnw6%2Fuploads%2Fgit-blob-50427cbb552e8fa12f24f92213a8094bdd4e6cca%2Fen-switch-to-initial-window-step.png?alt=media)

#### Switch To Step N's Window <a href="#switch-to-step-n-s-window" id="switch-to-step-n-s-window"></a>

This step is created when you switch from the current tab to the tab opened in step N (other than step 1). This step is also created when you switch from the current window to the window you opened in step N (other than step 1).

![](https://1964297753-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVdZPTgwISYb3LhjgKnw6%2Fuploads%2Fgit-blob-4e1c59453cd37cba9782a97c48ed9e09eb42b539%2Fen-switch-to-ns-window.png?alt=media)

This step has a **Target window** section where you can select which step's window you want to switch to.

![](https://1964297753-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVdZPTgwISYb3LhjgKnw6%2Fuploads%2Fgit-blob-72392e8e00b589a07faac3d157a18a38e34b10a5%2Fen-target-window.png?alt=media)

## Close a window or tab

The **Close Window** step is automatically added when a window or tab is closed during recording. Also, depending on which window/tab you go to after closing the window, a **Switch To Initial Window** or **Switch to step N's window** step is automatically added.

![](https://1964297753-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVdZPTgwISYb3LhjgKnw6%2Fuploads%2Fgit-blob-8e0342bb9b78c6fec96b7b47d44d05ce14c3c11e%2Fen-close-window.png?alt=media)

You can't add a **Close Window** step from the Scenario Edit Page, so you must create it during recording.

## Notes <a href="#notes" id="notes"></a>

* If there is no **Switch To Window** step, switching to another window/tab won't work properly, causing the test and local replay to fail.
* If you accidentally delete a **Switch To Window** step, you can create another **Switch to Window** step by performing any action at any point and use it instead.
* Due to Apple/iOS restrictions, in a real iOS device environment **Open Window**, **Switch To Window** and **Switch To Step N’s Window** are not supported. Furthermore, you cannot use a **JS** Step to click and open a new window since iOS will block such window treating it as an unwanted pop-up.
  * However if your web application opens a new window directly with a click, it may be possible to run it even on a real iOS device. Feel free to try it. Alternatively, if you can provide us with the test execution URL and permission to perform a manual test, we can investigate the issue for you. Feel free to contact us.
* Sometimes a **Close Window** step is created but not necessary (ex. click a button that closes the current tab with a script will create both a **Click** step and a **Close Window)**, it can occasionally cause an internal error on Chrome or Edge during test execution of the **Close Window**. However this can be solved by simply manually removing the **Close Window**


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.autify.com/nocode-web/en/autify-university/foundation/creating-a-scenario/open-switch-window-step.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
