puppeteer_click
Automate browser interactions by clicking elements on web pages using CSS selectors for precise control in Puppeteer-based automation workflows.
Instructions
Click an element on the page
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"selector": "<selector>"
},
"name": "puppeteer_click"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector for element to click |
Implementation Reference
- index.ts:212-230 (handler)Handler function for the puppeteer_click tool. Clicks the element specified by the CSS selector and returns 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 schema definition including name, description, and input schema requiring a 'selector' property.
{ 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)Registration of all tools including puppeteer_click via the ListToolsRequestHandler returning the TOOLS array.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, }));