playwright_hover
Simulate hovering over a specific web element using a CSS selector. This tool enables precise interaction with web pages for testing or automation purposes within a Playwright-based 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:123-134 (handler)The core handler implementation for the 'playwright_hover' tool. It waits for the selector, hovers over the element using Playwright's page.hover, and returns a success message.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:174-183 (schema)The input schema definition for the 'playwright_hover' tool, specifying the required 'selector' parameter.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:499-500 (registration)Registration and dispatch of the 'playwright_hover' tool in the main tool handler switch statement, calling the HoverTool's execute method.case "playwright_hover": return await hoverTool.execute(args, context);
- src/tools.ts:458-458 (registration)The tool is listed in the BROWSER_TOOLS array, used to determine browser requirements."playwright_hover",
- src/tools/codegen/generator.ts:79-79 (helper)Helper for code generation: handles 'playwright_hover' case in test code generator.case 'playwright_hover':