playwright_fill
Automatically populate an input field on a webpage by specifying its CSS selector and desired value, enabling precise browser automation through the MCP Playwright CDP server.
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/toolsHandler.ts:208-228 (handler)The main handler implementation for the 'playwright_fill' tool. It waits for the specified selector to appear on the page and then fills the input field with the provided value. Returns success or error message accordingly.case "playwright_fill": try { await page!.waitForSelector(args.selector); await page!.fill(args.selector, args.value); return { content: [{ type: "text", text: `Filled ${args.selector} with: ${args.value}`, }], isError: false, }; } catch (error) { return { content: [{ type: "text", text: `Failed to type ${args.selector}: ${(error as Error).message}`, }], isError: true, }; }