browser_switch_tab

Summary: Browser Switch TabPOST /api/execute/browser_switch_tab

Transfers 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

NameTypeRequiredDescription
context_idstringyesSession handle containing the document view to bring into foreground interaction.
tab_idstringyesUnique 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")

See Also