Skip to main content
Glama

playwright_hover

Simulate hovering over a web element using a CSS selector with the MCP Browser Automation Server, enabling precise interaction for automated browser tasks.

Instructions

Hover an element on the page

Input Schema

NameRequiredDescriptionDefault
selectorYesCSS selector for element to hover

Input Schema (JSON Schema)

{ "properties": { "selector": { "description": "CSS selector for element to hover", "type": "string" } }, "required": [ "selector" ], "type": "object" }

Implementation Reference

  • Handler implementation for the 'playwright_hover' tool. It waits for the specified selector to appear on the page and then hovers over it using Playwright's page.hover method. Returns a success message or an error if the operation fails.
    case "playwright_hover": try { await page!.waitForSelector(args.selector); await page!.hover(args.selector); return { toolResult: { content: [{ type: "text", text: `Hovered ${args.selector}`, }], isError: false, }, }; } catch (error) { return { toolResult: { content: [{ type: "text", text: `Failed to hover ${args.selector}: ${(error as Error).message}`, }], isError: true, }, }; }
  • Input schema defining the parameters for the 'playwright_hover' tool, which requires a CSS selector for the element to hover over.
    inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for element to hover" }, }, required: ["selector"], },
  • src/tools.ts:68-78 (registration)
    Registration of the 'playwright_hover' tool within the createToolDefinitions() function, including name, description, and input schema.
    { 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"], }, },
  • Helper constant BROWSER_TOOLS array that includes 'playwright_hover', used in toolsHandler.ts to determine if browser launch is required for this tool.
    export const BROWSER_TOOLS = [ "playwright_navigate", "playwright_screenshot", "playwright_click", "playwright_fill", "playwright_select", "playwright_hover", "playwright_evaluate" ];

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hrmeetsingh/mcp-browser-automation'

If you have feedback or need assistance with the MCP directory API, please join our Discord server