browser_switch_to_parent_frame
Switch back to the main webpage from an embedded iframe to continue browser automation tasks.
Instructions
Switches to the parent iframe
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/elementTools.ts:339-357 (handler)Handler for the 'browser_switch_to_parent_frame' tool. Registers the tool with MCP server and implements the logic by calling ElementService.switchToParentFrame(). Returns success or error message.server.tool('browser_switch_to_parent_frame', 'Switches to the parent iframe', async () => { try { const driver = stateManager.getDriver(); const elementService = new ElementService(driver); await elementService.switchToParentFrame(); return { content: [{ type: 'text', text: 'Switched to parent frame' }], }; } catch (e) { return { content: [ { type: 'text', text: `Error switching to parent frame: ${(e as Error).message}`, }, ], }; } });
- src/services/elementService.ts:86-88 (helper)Core helper method in ElementService that performs the actual switch to parent frame using Selenium WebDriver's switchTo().parentFrame().async switchToParentFrame(): Promise<void> { await this.driver.switchTo().parentFrame(); }