fill_form
Automatically populate multiple web form fields simultaneously using CSS selectors to streamline data entry and reduce manual input time.
Instructions
Fill multiple form fields at once
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fields | Yes | Object with selector as key and value as text to fill |
Implementation Reference
- browser.js:99-104 (handler)Core implementation of the fill_form tool. Loops through the fields object, ensuring the browser is launched, and fills each form field using Playwright's page.fill() method.
async fillForm(fields) { await this.ensureLaunched(); for (const [selector, value] of Object.entries(fields)) { await this.page.fill(selector, value); } } - tools-playwright.js:123-133 (schema)Input schema for the fill_form tool, specifying an object 'fields' where keys are CSS selectors and values are strings to input.
inputSchema: { type: 'object', properties: { fields: { type: 'object', additionalProperties: { type: 'string' }, description: 'Object with selector as key and value as text to fill' } }, required: ['fields'] }, - tools-playwright.js:120-138 (registration)Registration of the fill_form tool in the createPlaywrightTools function, including name, description, schema, and a handler that delegates to the browser instance's fillForm method.
{ name: 'fill_form', description: 'Fill multiple form fields at once', inputSchema: { type: 'object', properties: { fields: { type: 'object', additionalProperties: { type: 'string' }, description: 'Object with selector as key and value as text to fill' } }, required: ['fields'] }, handler: async ({ fields }) => { await browser.fillForm(fields); return { success: true, message: `Filled ${Object.keys(fields).length} form fields` }; } },