playwright_hover
Simulate mouse hover interactions on web elements using a CSS selector. Enables precise testing and automation in a real browser environment.
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
- src/tools/browser/interaction.ts:74-85 (handler)The execute method of HoverTool class implements the core logic for the playwright_hover tool: waits for the selector and hovers over the element using Playwright's page.hover.export class HoverTool extends BrowserToolBase { /** * Execute the hover tool */ async execute(args: any, context: ToolContext): Promise<ToolResponse> { return this.safeExecute(context, async (page) => { await page.waitForSelector(args.selector); await page.hover(args.selector); return createSuccessResponse(`Hovered ${args.selector}`); }); } }
- src/tools.ts:161-170 (schema)Tool definition including name, description, and input schema requiring a CSS selector.name: "playwright_hover", description: "Hover an element on the page", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for element to hover" }, }, required: ["selector"], }, },
- src/toolHandler.ts:480-481 (registration)Dispatch case in handleToolCall switch statement that routes playwright_hover calls to the HoverTool instance.case "playwright_hover": return await hoverTool.execute(args, context);
- src/tools.ts:412-412 (registration)Inclusion in BROWSER_TOOLS array used to conditionally launch browser for tools requiring it."playwright_hover",
- src/toolHandler.ts:27-27 (helper)Import of HoverTool class used in toolHandler.ts.HoverTool,