type
Enter text into web form fields using CSS selectors to automate form filling, data entry, and user interaction tasks during browser automation.
Instructions
Type text into an input field
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector for the input field | |
| text | Yes | Text to type |
Implementation Reference
- tools-playwright.js:99-102 (handler)The handler function for the MCP 'type' tool. It receives selector and text parameters and delegates to the browser.type method, returning a success message.handler: async ({ selector, text }) => { await browser.type(selector, text); return { success: true, message: `Typed "${text}" into ${selector}` }; }
- tools-playwright.js:91-98 (schema)The input schema for the 'type' tool, specifying the required selector (string) and text (string) parameters.inputSchema: { type: 'object', properties: { selector: { type: 'string', description: 'CSS selector for the input field' }, text: { type: 'string', description: 'Text to type' } }, required: ['selector', 'text'] },
- tools-playwright.js:88-102 (registration)The complete tool registration object for the 'type' tool, including name, description, inputSchema, and handler. This object is included in the playwright tools array exported by createPlaywrightTools.{ name: 'type', description: 'Type text into an input field', inputSchema: { type: 'object', properties: { selector: { type: 'string', description: 'CSS selector for the input field' }, text: { type: 'string', description: 'Text to type' } }, required: ['selector', 'text'] }, handler: async ({ selector, text }) => { await browser.type(selector, text); return { success: true, message: `Typed "${text}" into ${selector}` }; }
- browser.js:89-92 (helper)The browser.type helper method implementation, which ensures the browser is launched and performs the actual text input using Playwright's page.fill method.async type(selector, text) { await this.ensureLaunched(); await this.page.fill(selector, text); }