puppeteer_click
Automate browser interactions by clicking elements on a webpage using CSS selectors, enabling precise control over user actions in a Puppeteer-based environment.
Instructions
Click an element on the page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector for element to click |
Implementation Reference
- index.ts:212-230 (handler)Switch case in handleToolCall function that executes the puppeteer_click tool: clicks the element matching the CSS selector and returns a success or error message.case "puppeteer_click": try { await page.click(args.selector); return { content: [{ type: "text", text: `Clicked: ${args.selector}`, }], isError: false, }; } catch (error) { return { content: [{ type: "text", text: `Failed to click ${args.selector}: ${(error as Error).message}`, }], isError: true, }; }
- index.ts:44-54 (schema)Tool definition in the TOOLS array, specifying the name, description, and input schema requiring a 'selector' string.{ name: "puppeteer_click", description: "Click an element on the page", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for element to click" }, }, required: ["selector"], }, },
- index.ts:410-412 (registration)Handler for ListToolsRequestSchema that returns the TOOLS array containing the puppeteer_click tool definition.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, }));