puppeteer_select
Automates the selection of dropdown elements on web pages using CSS selectors and specified values, integrating with Puppeteer for browser automation and form interactions.
Instructions
Select an element on the page with Select tag
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector for element to select | |
| value | Yes | Value to select |
Implementation Reference
- src/tools/handlers.ts:182-201 (handler)The core handler function for the 'puppeteer_select' tool. It waits for the selector, selects the option using Puppeteer's page.select method, and returns success or error response.case "puppeteer_select": try { await page.waitForSelector(args.selector); await page.select(args.selector, args.value); return { content: [{ type: "text", text: `Selected ${args.selector} with: ${args.value}`, }], isError: false, }; } catch (error) { return { content: [{ type: "text", text: `Failed to select ${args.selector}: ${(error as Error).message}`, }], isError: true, }; }
- src/tools/definitions.ts:72-82 (schema)The tool schema definition including name, description, and input schema for validation.name: "puppeteer_select", description: "Select an element on the page with Select tag", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for element to select" }, value: { type: "string", description: "Value to select" }, }, required: ["selector", "value"], }, },
- src/server.ts:35-37 (registration)Registration of all tools (including puppeteer_select) via the TOOLS array for the ListTools request handler.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, }));