# Multi-tab & iframes

> For the complete documentation index, see [llms.txt](/llms.txt)

unotest scenarios can span tabs and reach into frames.

## Switch tabs

When an action opens a new tab, switch to it by index (0-based):

```js
step("Open the invoice in a new tab", () => {
  click(getByRole("link", { name: "View invoice" }));
  setPage(1);                      // focus the new tab
  assertVisible(getByText("Invoice #"));
});
```

Inspect tabs with the `list_pages` / `get_active_context` MCP tools while
exploring.

:::note[Waiting for a new tab]
`waitForPage()` isn't shipped yet. For a tab that opens asynchronously, use
`pause(ms)` with a `// reason:` comment until it lands.
:::

## Work inside an iframe

Enter a frame to scope subsequent calls; exit when done:

```js
step("Submit the embedded payment form", () => {
  enterFrame(getByTestId("payment-iframe"));
  fill(getByLabel("Card number"), TEST_CARD);
  click(getByRole("button", { name: "Pay" }));
  exitFrame();
});
```

Or resolve a single element across the boundary with `contentFrame()`. See the
[DSL reference](/reference/dsl/).
