browser_hover
Hover over elements on web pages to trigger interactive features like dropdown menus, tooltips, and hover effects during browser automation with Playwright MCP.
Instructions
Hover over element on page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| element | Yes | Human-readable element description used to obtain permission to interact with the element | |
| ref | Yes | Exact target element reference from the page snapshot |
Implementation Reference
- src/tools/snapshot.ts:121-137 (handler)Handler function that executes the browser_hover tool: resolves locator from snapshot, generates code snippet, and performs hover action via Playwright.handle: async (context, params) => { const snapshot = context.currentTabOrDie().snapshotOrDie(); const locator = snapshot.refLocator(params); const code = [ `// Hover over ${params.element}`, `await page.${await generateLocator(locator)}.hover();` ]; return { code, action: () => locator.hover(), captureSnapshot: true, waitForNetwork: true, }; }, });
- src/tools/snapshot.ts:113-119 (schema)Input/output schema definition for browser_hover tool, using shared elementSchema for element ref and description.schema: { name: 'browser_hover', title: 'Hover mouse', description: 'Hover over element on page', inputSchema: elementSchema, type: 'readOnly', },
- src/tools/snapshot.ts:44-47 (schema)Shared Zod schema for element input, used by browser_hover and other interaction tools.const elementSchema = z.object({ element: z.string().describe('Human-readable element description used to obtain permission to interact with the element'), ref: z.string().describe('Exact target element reference from the page snapshot'), });
- src/tools/snapshot.ts:219-226 (registration)Registration of the hover tool in the default export array of snapshot-related tools.export default [ snapshot, click, drag, hover, type, selectOption, ];
- src/tools.ts:36-52 (registration)Central registration of snapshot tools array, which includes the browser_hover tool via spread of snapshot exports.export const snapshotTools: Tool<any>[] = [ ...common(true), ...console, ...dialogs(true), ...files(true), ...install, ...keyboard(true), ...navigate(true), ...network, ...pdf, ...screenshot, ...snapshot, ...tabs(true), ...testing, ...video, ...wait(true), ];