playwright_iframe_fill
Fill form elements within iframes using CSS selectors to automate interactions with embedded content in web pages.
Instructions
Fill an element in an iframe on the page
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| iframeSelector | Yes | CSS selector for the iframe containing the element to fill | |
| selector | Yes | CSS selector for the element to fill | |
| value | Yes | Value to fill |
Implementation Reference
- src/tools/browser/interaction.ts:76-93 (handler)IframeFillTool class that implements the core logic for the 'playwright_iframe_fill' tool using Playwright's frameLocator to locate the iframe and fill the specified element with the given value.
export class IframeFillTool extends BrowserToolBase { /** * Execute the iframe fill 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).fill(args.value); return createSuccessResponse( `Filled element ${args.selector} inside iframe ${args.iframeSelector} with: ${args.value}`, ); }); } } - src/tools.ts:146-158 (schema)Tool schema definition including name, description, and input schema for validating arguments: iframeSelector, selector, and value.
{ name: "playwright_iframe_fill", description: "Fill 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 fill" }, selector: { type: "string", description: "CSS selector for the element to fill" }, value: { type: "string", description: "Value to fill" }, }, required: ["iframeSelector", "selector", "value"], }, }, - src/toolHandler.ts:591-592 (registration)Registration in the main tool handler switch statement that routes calls to 'playwright_iframe_fill' to the IframeFillTool instance's execute method.
case "playwright_iframe_fill": return await iframeFillTool.execute(args, context); - src/toolHandler.ts:394-394 (registration)Instantiation of the IframeFillTool instance used for handling the tool calls.
if (!iframeFillTool) iframeFillTool = new IframeFillTool(server); - src/toolHandler.ts:28-28 (registration)Import of IframeFillTool from the interaction module.
IframeFillTool,