type
Simulate user text entry in web forms for automated testing. Enter specified text into input fields using CSS selectors to validate form functionality during QA processes.
Instructions
Type text into an input field identified by a CSS selector
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector of the input field | |
| text | Yes | Text to type |
Implementation Reference
- src/browser.ts:61-70 (handler)The core handler function for the 'type' tool that uses Puppeteer to type text into the specified selector on the browser page.async type(selector: string, text: string) { const page = await this.init(); try { await page.waitForSelector(selector, { timeout: 5000 }); await page.type(selector, text); return `Typed "${text}" into ${selector}`; } catch (e: any) { throw new Error(`Failed to type into ${selector}: ${e.message}`); } }
- src/index.ts:52-58 (schema)Input schema definition for the 'type' tool, specifying parameters selector and text.type: "object", properties: { selector: { type: "string", description: "CSS selector of the input field" }, text: { type: "string", description: "Text to type" }, }, required: ["selector", "text"], },
- src/index.ts:49-59 (registration)Tool registration in the TOOLS array used for listTools response.name: "type", description: "Type text into an input field identified by a CSS selector", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector of the input field" }, text: { type: "string", description: "Text to type" }, }, required: ["selector", "text"], }, },
- src/index.ts:126-128 (registration)Dispatcher/registration of the 'type' tool handler in the callTool switch statement.case "type": result = await browserManager.type(String(args?.selector), String(args?.text)); break;