Skip to main content
Glama

browser_hover_text

Simulate hovering over a web page element using its text content for precise interaction during vulnerability testing, enhancing web application security assessments.

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

  • Handler implementation for the browser_hover_text tool. Hovers over the page element matching the provided text using Playwright's getByText().hover(), with fallback for strict mode violations by targeting the first matching element.
    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, }; }
  • Input schema definition for the browser_hover_text tool, specifying a required 'text' string parameter.
    inputSchema: { type: "object", properties: { text: { type: "string", description: "Text content of the element to hover" }, }, required: ["text"], },
  • index.ts:144-154 (registration)
    Registration of the browser_hover_text tool in the TOOLS array used by the MCP server for listing available tools.
    { 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"], }, },
  • Enum constant definition mapping BrowserHoverText to the tool name string 'browser_hover_text'.
    BrowserHoverText = "browser_hover_text",

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

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