puppeteer_hover
Simulate mouse hover action on a webpage element using a CSS selector. Enables precise interactions in browser automation tasks with Puppeteer MCP Server.
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:306-331 (handler)Implements the puppeteer_hover tool by waiting for the specified selector and hovering over the element using Puppeteer's page.hover method, with error handling.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 as Error).message }`, }, ], isError: true, }; }
- index.ts:97-110 (schema)Defines the tool metadata including name, description, and input schema requiring a 'selector' string for the puppeteer_hover tool.{ 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:459-461 (registration)Registers the puppeteer_hover tool (along with others) by including it in the TOOLS array returned for list tools requests.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, }));