Skip to main content
Glama

playwright_iframe_click

Click elements within iframes on web pages using CSS selectors for both the iframe and the target element. Enables precise browser automation for interacting with embedded content.

Instructions

Click an element in an iframe on the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
iframeSelectorYesCSS selector for the iframe containing the element to click
selectorYesCSS selector for the element to click

Implementation Reference

  • The core handler implementation for the 'playwright_iframe_click' tool. Uses Playwright's frameLocator to locate the iframe and click the specified element inside it.
    export class IframeClickTool extends BrowserToolBase { /** * Execute the iframe click tool */ async execute(args: any, context: ToolContext): Promise<ToolResponse> { return this.safeExecute(context, async (page) => { const frame = page.frameLocator(args.iframeSelector); if (!frame) { return createErrorResponse(`Iframe not found: ${args.iframeSelector}`); } await frame.locator(args.selector).click(); return createSuccessResponse(`Clicked element ${args.selector} inside iframe ${args.iframeSelector}`); }); } }
  • The input/output schema definition for the tool, specifying parameters iframeSelector and selector.
    { name: "playwright_iframe_click", description: "Click an element in an iframe on the page", inputSchema: { type: "object", properties: { iframeSelector: { type: "string", description: "CSS selector for the iframe containing the element to click" }, selector: { type: "string", description: "CSS selector for the element to click" }, }, required: ["iframeSelector", "selector"], }, },
  • Dispatch registration in the main tool handler switch statement, routing calls to the IframeClickTool instance.
    case "playwright_click": return await clickTool.execute(args, context); case "playwright_iframe_click": return await iframeClickTool.execute(args, context);
  • src/index.ts:22-27 (registration)
    Registers all tools (including schema for playwright_iframe_click) with the MCP server via createToolDefinitions() and setupRequestHandlers.
    // Create tool definitions const TOOLS = createToolDefinitions(); // Setup request handlers setupRequestHandlers(server, TOOLS);
  • src/tools.ts:453-454 (registration)
    Includes 'playwright_iframe_click' in the BROWSER_TOOLS array used for conditional browser launching.
    "playwright_click", "playwright_iframe_click",

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/executeautomation/mcp-playwright'

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