Skip to main content
Glama
dragons96

MCP-Undetected-Chromedriver

by dragons96

browser_iframe_click

Interact with elements inside iframes using this tool. It automates clicks on specific elements within iframes, simplifying web automation and scraping tasks on protected sites with anti-bot measures.

Instructions

Click an element inside an iframe on the page

Args:
    iframeSelector: The selector of the iframe - required
    selector: The selector of the element to click - required

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
iframeSelectorYes
selectorYes

Implementation Reference

  • The handler function for browser_iframe_click tool. It validates inputs, switches to the specified iframe using Selenium, clicks the target element by CSS selector, switches back to default content, and returns a success response. Registered as an MCP tool via the @mcp.tool() decorator.
    @mcp.tool()
    async def browser_iframe_click(
            iframeSelector: str,
            selector: str,
    ):
        """Click an element inside an iframe on the page
    
        Args:
            iframeSelector: The selector of the iframe - required
            selector: The selector of the element to click - required
        """
        assert iframeSelector, "Iframe selector is required"
        assert selector, "Selector is required"
    
        async def iframe_click_handler(driver: uc.Chrome):
            iframe = driver.find_element(By.CSS_SELECTOR, iframeSelector)
            driver.switch_to.frame(iframe)
            driver.find_element(By.CSS_SELECTOR, selector).click()
            driver.switch_to.default_content()
            return await create_success_response(
                f"Clicked element {selector} inside iframe {iframeSelector}"
            )
    
        return await tool.safe_execute(
            ToolContext(webdriver=await ensure_browser()), iframe_click_handler
        )

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/dragons96/mcp-undetected-chromedriver'

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