browser_fill
Automatically populate form fields in web browsers using element selectors and specified values to streamline data entry tasks.
Instructions
Fill a form field
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instanceId | Yes | Instance ID | |
| selector | Yes | Element selector | |
| value | Yes | Value to fill | |
| timeout | No | Timeout in milliseconds |
Implementation Reference
- src/tools.ts:747-767 (handler)The core handler function that executes the browser_fill tool logic using Playwright's page.fill method to fill a form field with the given value.private async fill(instanceId: string, selector: string, value: string, timeout: number): Promise<ToolResult> { const instance = this.browserManager.getInstance(instanceId); if (!instance) { return { success: false, error: `Instance ${instanceId} not found` }; } try { await instance.page.fill(selector, value, { timeout }); return { success: true, data: { selector, value, filled: true }, instanceId }; } catch (error) { return { success: false, error: `Fill failed: ${error instanceof Error ? error.message : error}`, instanceId }; } }
- src/tools.ts:240-262 (schema)Input schema definition for the browser_fill tool, specifying parameters like instanceId, selector, value, and timeout.inputSchema: { type: 'object', properties: { instanceId: { type: 'string', description: 'Instance ID' }, selector: { type: 'string', description: 'Element selector', }, value: { type: 'string', description: 'Value to fill', }, timeout: { type: 'number', description: 'Timeout in milliseconds', default: 30000 } }, required: ['instanceId', 'selector', 'value'] }
- src/tools.ts:237-263 (registration)Tool registration in the getTools() method, defining name, description, and input schema for browser_fill.{ name: 'browser_fill', description: 'Fill a form field', inputSchema: { type: 'object', properties: { instanceId: { type: 'string', description: 'Instance ID' }, selector: { type: 'string', description: 'Element selector', }, value: { type: 'string', description: 'Value to fill', }, timeout: { type: 'number', description: 'Timeout in milliseconds', default: 30000 } }, required: ['instanceId', 'selector', 'value'] } },
- src/tools.ts:547-549 (registration)Dispatch/registration in the executeTools switch statement that routes browser_fill calls to the fill handler method.case 'browser_fill': return await this.fill(args.instanceId, args.selector, args.value, args.timeout || 30000);