playwright_fill
Automatically populate an input field on a web page by specifying a CSS selector and the desired value, enabling precise browser automation with Playwright.
Instructions
fill out an input field
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector for input field | |
| value | Yes | Value to fill |
Implementation Reference
- src/tools/browser/interaction.ts:91-102 (handler)The FillTool class provides the core implementation of the playwright_fill tool, using Playwright's page.fill method after waiting for the selector.export class FillTool extends BrowserToolBase { /** * Execute the fill tool */ async execute(args: any, context: ToolContext): Promise<ToolResponse> { return this.safeExecute(context, async (page) => { await page.waitForSelector(args.selector); await page.fill(args.selector, args.value); return createSuccessResponse(`Filled ${args.selector} with: ${args.value}`); }); } }
- src/tools.ts:149-160 (schema)Input schema definition for the playwright_fill tool, specifying selector and value parameters.{ name: "playwright_fill", description: "fill out an input field", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for input field" }, value: { type: "string", description: "Value to fill" }, }, required: ["selector", "value"], }, },
- src/toolHandler.ts:493-494 (registration)Registration in the main tool handler switch statement, dispatching calls to the FillTool instance.case "playwright_fill": return await fillTool.execute(args, context);
- src/toolHandler.ts:324-324 (registration)Instantiation of the FillTool instance during tool initialization.if (!fillTool) fillTool = new FillTool(server);
- Helper method in codegen generator to produce Playwright test code for fill actions.private generateFillStep(parameters: Record<string, unknown>): string { const { selector, value } = parameters; return ` // Fill input field await page.fill('${selector}', '${value}');`; }