click
Simulate user interactions by clicking specified elements on web pages using CSS selectors, enabling efficient testing and automation of consent management platforms within a browser environment.
Instructions
Click elements on the page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector for element to click |
Implementation Reference
- src/index.ts:283-305 (handler)The switch case in handleToolCall function that implements the logic for the 'click' tool: clicks the element matching the given CSS selector using Puppeteer's page.click method, with success/error response handling.case "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, }; }
- src/index.ts:66-78 (registration)The 'click' tool definition in the TOOLS array, which registers the tool with MCP server including its name, description, and input schema.name: "click", description: "Click elements on the page", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for element to click", }, }, required: ["selector"], }, },
- src/index.ts:68-77 (schema)The input schema for the 'click' tool, defining the required 'selector' parameter as a CSS selector string.inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for element to click", }, }, required: ["selector"], },