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
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"iframeSelector": "<iframeSelector>",
"selector": "<selector>"
},
"name": "playwright_iframe_click"
}
}Input 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.execute
case "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 call
if (!iframeClickTool) iframeClickTool = new IframeClickTool(server); - src/toolHandler.ts:24-24 (registration)Import of the IframeClickTool class from its implementation file
IframeClickTool,