Skip to main content
Glama
jomon003

PlayMCP Browser Automation Server

by jomon003

hover

Hover over web page elements to trigger interactive features, reveal hidden content, or prepare for further actions during browser automation.

Instructions

Hover over an element on the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYes

Implementation Reference

  • Core handler function in PlaywrightController that locates the element using the provided selector and performs the hover action using Playwright's locator.hover() method, with error handling and logging.
    async hover(selector: string): Promise<void> { try { if (!this.isInitialized() || !this.state.page) { throw new Error('Browser not initialized'); } this.log('Hovering over element', { selector }); const locator = this.state.page.locator(selector); await locator.hover(); this.log('Hover complete'); } catch (error: any) { console.error('Hover error:', error); throw new BrowserError('Failed to hover over element', 'Check if the selector exists and is visible'); } }
  • Defines the Tool object for 'hover' including name, description, and inputSchema requiring a 'selector' string parameter.
    const HOVER_TOOL: Tool = { name: "hover", description: "Hover over an element on the page", inputSchema: { type: "object", properties: { selector: { type: "string" } }, required: ["selector"] } };
  • src/server.ts:536-536 (registration)
    Registers the HOVER_TOOL in the 'tools' object which is provided to the MCP Server capabilities.
    hover: HOVER_TOOL,
  • MCP request handler in the 'callTool' switch statement that validates the selector argument, calls the PlaywrightController.hover method, and returns success response.
    case 'hover': { if (!args.selector) { return { content: [{ type: "text", text: "Selector is required" }], isError: true }; } await playwrightController.hover(args.selector as string); return { content: [{ type: "text", text: "Hover completed successfully" }] }; }

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/jomon003/PlayMCP'

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