Skip to main content
Glama

browser_switch_to_default_content

Return to the main browser window content after interacting with frames or iframes during web automation testing.

Instructions

Switches to the default content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The inline handler function for the 'browser_switch_to_default_content' tool, which creates an ElementService instance and calls switchToDefaultContent() on it, handling errors and returning success/error messages.
    server.tool('browser_switch_to_default_content', 'Switches to the default content', async () => { try { const driver = stateManager.getDriver(); const elementService = new ElementService(driver); await elementService.switchToDefaultContent(); return { content: [{ type: 'text', text: 'Switched to default content' }], }; } catch (e) { return { content: [ { type: 'text', text: `Error switching to default content: ${(e as Error).message}`, }, ], }; } });
  • The core helper method in ElementService that switches the WebDriver context back to the default content.
    async switchToDefaultContent(): Promise<void> { await this.driver.switchTo().defaultContent(); }
  • Registration of the tool using server.tool() within the registerElementTools function.
    server.tool('browser_switch_to_default_content', 'Switches to the default content', async () => { try { const driver = stateManager.getDriver(); const elementService = new ElementService(driver); await elementService.switchToDefaultContent(); return { content: [{ type: 'text', text: 'Switched to default content' }], }; } catch (e) { return { content: [ { type: 'text', text: `Error switching to default content: ${(e as Error).message}`, }, ], }; } });

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