playwright_iframe_click
Interact with elements inside iframes on a webpage by specifying iframe and element selectors, enabling precise actions in web automation and testing scenarios.
Instructions
Click an element in an iframe on the page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| iframeSelector | Yes | CSS selector for the iframe containing the element to click | |
| selector | Yes | CSS selector for the element to click |
Implementation Reference
- src/tools/browser/interaction.ts:22-37 (handler)IframeClickTool class containing the execute method that performs the iframe click using Playwright frameLocator and locator.click()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}`); }); } }
- src/tools.ts:124-135 (schema)Input schema definition for the playwright_iframe_click tool, specifying required iframeSelector and selector parameters{ 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"], }, },
- src/toolHandler.ts:471-472 (registration)Tool registration in the main handleToolCall switch statement, dispatching to iframeClickTool.executecase "playwright_iframe_click": return await iframeClickTool.execute(args, context);
- src/toolHandler.ts:291-291 (registration)Instantiation of the IframeClickTool instance used for handling the tool callif (!iframeClickTool) iframeClickTool = new IframeClickTool(server);
- src/toolHandler.ts:24-24 (registration)Import of the IframeClickTool class from its implementation fileIframeClickTool,