Skip to main content
Glama

browser_switch_to_parent_frame

Switch back to the parent frame when working with nested iframes in web automation. This allows you to navigate between iframe contexts and return to the main document structure.

Instructions

Switches to the parent iframe

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler and registration for the browser_switch_to_parent_frame tool. Retrieves the WebDriver instance, instantiates ElementService, calls switchToParentFrame on it, and returns a success or error message in the expected format.
    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}`, }, ], }; } });
  • The core helper method in ElementService that switches the WebDriver context to the parent frame.
    async switchToParentFrame(): Promise<void> { await this.driver.switchTo().parentFrame(); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pshivapr/selenium-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server