puppeteer_hover
Simulate mouse hover interactions on web elements using CSS selectors for automated browser testing and interaction scenarios.
Instructions
Hover an element on the page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector for element to hover |
Implementation Reference
- index.ts:322-342 (handler)Implements the puppeteer_hover tool logic within the handleToolCall switch statement: waits for the CSS selector, hovers over the element using Puppeteer, returns success message or catches and reports errors.case "puppeteer_hover": try { await page.waitForSelector(args.selector); await page.hover(args.selector); return { content: [{ type: "text", text: `Hovered ${args.selector}`, }], isError: false, }; } catch (error) { return { content: [{ type: "text", text: `Failed to hover ${args.selector}: ${error.message}`, }], isError: true, }; }
- index.ts:163-173 (schema)Defines the input schema, name, and description for the puppeteer_hover tool in the TOOLS array.{ name: "puppeteer_hover", description: "Hover an element on the page", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for element to hover" }, }, required: ["selector"], }, },
- index.ts:447-449 (registration)Registers the puppeteer_hover tool (among others in TOOLS) by handling ListToolsRequestSchema.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, }));
- index.ts:451-451 (registration)Registers the call handler for all tools, including puppeteer_hover, dispatching to handleToolCall based on name.server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}));