Skip to main content
Glama

browser_hover_text

Hover over webpage elements by text content to identify interactive components during security testing for vulnerability detection.

Instructions

Hover an element on the page by its text content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesText content of the element to hover

Implementation Reference

  • The main handler logic for the 'browser_hover_text' tool. It uses Playwright's page.getByText to locate an element by text and calls hover() on it, with comprehensive error handling including retry for strict mode violations.
    case ToolName.BrowserHoverText: try { await page.getByText(args.text).hover(); return { content: [{ type: "text", text: `Hovered element with text: ${args.text}`, }], 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.getByText(args.text).first().hover(); return { content: [{ type: "text", text: `Hovered element with text: ${args.text}`, }], isError: false, }; } catch (error) { return { content: [{ type: "text", text: `Failed (twice) to hover element with text ${args.text}: ${(error as Error).message}`, }], isError: true, }; } } return { content: [{ type: "text", text: `Failed to hover element with text ${args.text}: ${(error as Error).message}`, }], isError: true, }; }
  • index.ts:144-154 (registration)
    Registration of the 'browser_hover_text' tool in the TOOLS array, including its name (ToolName.BrowserHoverText), description, and input schema definition. This array is used by the ListToolsRequestSchema handler.
    { name: ToolName.BrowserHoverText, description: "Hover an element on the page by its text content", inputSchema: { type: "object", properties: { text: { type: "string", description: "Text content of the element to hover" }, }, required: ["text"], }, },
  • Input schema for the 'browser_hover_text' tool, defining a required 'text' string parameter.
    inputSchema: { type: "object", properties: { text: { type: "string", description: "Text content of the element to hover" }, }, required: ["text"], },
  • Enum constant defining the tool name string 'browser_hover_text' used throughout the code.
    BrowserHoverText = "browser_hover_text",

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/9olidity/MCP-Server-Pentest'

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