playwright_iframe_fill
Fill elements within iframes on web pages using CSS selectors and specified values, enabling precise browser automation in Playwright.
Instructions
Fill 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 fill | |
| selector | Yes | CSS selector for the element to fill | |
| value | Yes | Value to fill |
Implementation Reference
- src/tools/browser/interaction.ts:71-86 (handler)Implementation of the IframeFillTool class which contains the execute method handling the playwright_iframe_fill tool logic using Playwright frameLocator and fill.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:137-148 (schema)Tool schema definition including name, description, and input schema for validation.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:490-491 (registration)Switch case in handleToolCall that registers and dispatches to the IframeFillTool handler.case "playwright_iframe_fill": return await iframeFillTool.execute(args, context);
- src/tools.ts:455-455 (registration)Inclusion in BROWSER_TOOLS array for conditional browser launch."playwright_iframe_fill",
- src/toolHandler.ts:323-323 (helper)Instantiation of the IframeFillTool instance in initializeTools.if (!iframeFillTool) iframeFillTool = new IframeFillTool(server);