Skip to main content
Glama

browser_switch_to_default_content

Return to the main browser window from frames or iframes during web automation with Selenium WebDriver.

Instructions

Switches to the default content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The inline handler function registered for the 'browser_switch_to_default_content' tool. It retrieves the WebDriver from stateManager, instantiates ElementService, calls switchToDefaultContent(), and returns a success or error message in MCP content format.
    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 class that executes the browser switch to default content using Selenium WebDriver's switchTo().defaultContent().
    async switchToDefaultContent(): Promise<void> { await this.driver.switchTo().defaultContent(); }
  • Registration of the 'browser_switch_to_default_content' tool using server.tool() with description and inline handler 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