> ## Documentation Index
> Fetch the complete documentation index at: https://momentic.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# switchTab

> Switch the active tab by index, URL substring, or URL regex.

Provide exactly one of `substring`, `regex`, or `index`. The simplified form is
a substring (string) or an index (number).

## Parameters

| Parameter   | Type               | Required | Description                                              |
| ----------- | ------------------ | -------- | -------------------------------------------------------- |
| `substring` | `string`           | No       | Match the URL by substring.                              |
| `regex`     | `string`           | No       | Match the URL by regular expression.                     |
| `index`     | `number \| string` | No       | Zero-based tab index.                                    |
| `timeout`   | `number`           | No       | Maximum time in milliseconds to wait for a matching tab. |

## Shorthand

Substring (string) or zero-based index (number).

```yaml theme={null}
- switchTab: blog
```

## Examples

```yaml theme={null}
- switchTab:
    substring: /companies/momentic/jobs/938G5qp
    timeout: 15000
```

```yaml theme={null}
- switchTab:
    substring: randomly-changing-link
```

```yaml theme={null}
- switchTab:
    regex: practice-tab-search
```

```yaml theme={null}
- switchTab: 1
```

## Related

* [Test format](/core-concepts/test-format)
