Skip to main content
Glama

playwright_hover

Simulate mouse hover interactions on web elements using CSS selectors for testing or automation workflows.

Instructions

Hover an element on the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for element to hover

Implementation Reference

  • The HoverTool.execute method provides the core implementation of the playwright_hover tool, waiting for the selector and performing a hover action 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}`); }); } }
  • JSON schema defining the input parameters for the playwright_hover tool, 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"], }, },
  • Registration in the main tool handler switch statement that dispatches playwright_hover calls to the HoverTool instance.
    case "playwright_hover": return await hoverTool.execute(args, context);
  • Initialization of the global HoverTool instance in toolHandler.ts.
    if (!hoverTool) hoverTool = new HoverTool(server);
  • Codegen helper that generates Playwright test code for the hover action.
    case "playwright_hover": return this.generateHoverStep(parameters);

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/aakashH242/mcp-playwright'

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