Skip to main content
Glama

playwright_iframe_click

Click elements within iframes during browser automation by specifying both iframe and element selectors to interact with nested page 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 'playwright_iframe_click' in the IframeClickTool class. It locates the iframe using frameLocator, checks if it exists, clicks the specified element inside it, and returns a success message.
    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 tool definition including name, description, and input schema (iframeSelector and selector required) for 'playwright_iframe_click'.
    { 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"], }, },
  • Instantiation of the IframeClickTool instance in the initializeTools function.
    if (!iframeClickTool) iframeClickTool = new IframeClickTool(server);
  • The switch case in handleToolCall function that dispatches 'playwright_iframe_click' calls to the iframeClickTool's execute method.
    return await iframeClickTool.execute(args, context);
  • Type declaration for the iframeClickTool instance variable.
    let iframeClickTool: IframeClickTool;

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

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