browser_switch_tab
POST /api/execute/browser_switch_tabTransfers active interaction control to a designated document within the session so subsequent navigation and DOM commands address it. Upon switching, the engine updates its active view pointer and fires standard visibility and focus lifecycle events (`visibilitychange`, `focus`) inside the newly foregrounded Blink renderer. Meanwhile, the previously active view transitions into the background where its JavaScript timers, WebSockets, and network fetches continue running uninterrupted. Supplying a valid handle retrieved from the target directory completes synchronously and confirms the transition in the response payload. Providing a nonexistent or previously closed handle returns a lookup error while leaving the current foreground document unchanged, preserving ongoing script execution, and keeping the active environment ready for further automation commands.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| context_id | string | yes | Session handle containing the document view to bring into foreground interaction. |
| tab_id | string | yes | Unique handle of the destination document obtained from the session's open view listing. |
Usage
result = await browser.switch_tab(context_id=context_id, tab_id="value")