Skip to main content
Glama
devskido

Playwright MCP Server

by devskido

playwright_iframe_click

Click elements within iframes using CSS selectors to interact with embedded content in web pages.

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 execute method of IframeClickTool performs the iframe click using Playwright's frameLocator to select the iframe and locator.click() on the target element within it. It handles the case where the iframe is not found.
    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}`); }); } }
  • Input schema defining the parameters iframeSelector and selector as required strings for identifying the iframe and element to 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"], }, },
  • In the main tool handler switch statement, calls the execute method of the pre-instantiated iframeClickTool instance.
    case "playwright_iframe_click": return await iframeClickTool.execute(args, context);
  • Instantiation of the IframeClickTool instance during tool initialization in handleToolCall.
    if (!iframeClickTool) iframeClickTool = new IframeClickTool(server);
  • Import of IframeClickTool from './tools/browser/interaction.js'.
    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/devskido/customed-playwright'

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