browser_hover
Hover over webpage elements using CSS selectors to test interactive components and identify potential security vulnerabilities during penetration testing.
Instructions
Hover an element on the page using CSS selector
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector for element to hover |
Implementation Reference
- index.ts:465-504 (handler)Handler implementation for 'browser_hover' tool: hovers over the page element matching the given CSS selector using Playwright's locator.hover(), with error handling and retry for strict mode violations.case ToolName.BrowserHover: try { await page.locator(args.selector).hover(); return { content: [{ type: "text", text: `Hovered ${args.selector}`, }], isError: false, }; } catch (error) { if((error as Error).message.includes("strict mode violation")) { console.log("Strict mode violation, retrying on first element..."); try { await page.locator(args.selector).first().hover(); 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, }; } } return { content: [{ type: "text", text: `Failed to hover ${args.selector}: ${(error as Error).message}`, }], isError: true, }; }
- index.ts:133-143 (schema)Input schema for 'browser_hover' tool, defining the required 'selector' parameter as a CSS selector string.{ name: ToolName.BrowserHover, description: "Hover an element on the page using CSS selector", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for element to hover" }, }, required: ["selector"], }, },
- index.ts:840-842 (registration)Registration of the tool list handler, exposing 'browser_hover' (via TOOLS array) through ListToolsRequestSchema.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, }));
- index.ts:844-846 (registration)Registration of the CallToolRequestSchema handler, which routes calls to the specific tool handler based on name.server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name as ToolName, request.params.arguments ?? {}) );
- index.ts:22-35 (helper)Enum definition mapping 'browser_hover' string to ToolName.BrowserHover constant used throughout the code.enum ToolName { BrowserNavigate = "browser_navigate", BrowserScreenshot = "browser_screenshot", BrowserClick = "browser_click", BrowserClickText = "browser_click_text", BrowserFill = "browser_fill", BrowserSelect = "browser_select", BrowserSelectText = "browser_select_text", BrowserHover = "browser_hover", BrowserHoverText = "browser_hover_text", BrowserEvaluate = "browser_evaluate", BrowserUrlReflectedXss = "broser_url_reflected_xss", BrowserUrlSqlInjection = "browser_url_sql_injection" }