hover
Simulate mouse hover on webpage elements to trigger interactive states and inspect dynamic content behavior during browser automation and debugging.
Instructions
Hover over the provided element
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uid | Yes | The uid of an element on the page from the page content snapshot |
Implementation Reference
- src/tools/input.ts:68-80 (handler)The handler function that performs the hover action on the element identified by the provided UID using the context's locator.
handler: async (request, response, context) => { const uid = request.params.uid; const handle = await context.getElementByUid(uid); try { await context.waitForEventsAfterAction(async () => { await handle.asLocator().hover(); }); response.appendResponseLine(`Successfully hovered over the element`); response.setIncludeSnapshot(true); } finally { void handle.dispose(); } }, - src/tools/input.ts:61-67 (schema)Zod schema defining the input parameter 'uid' for the hover tool.
schema: { uid: z .string() .describe( 'The uid of an element on the page from the page content snapshot', ), }, - src/tools/input.ts:54-81 (registration)The complete definition and export of the 'hover' tool using defineTool, which registers the tool's metadata, schema, and handler.
export const hover = defineTool({ name: 'hover', description: `Hover over the provided element`, annotations: { category: ToolCategories.INPUT_AUTOMATION, readOnlyHint: false, }, schema: { uid: z .string() .describe( 'The uid of an element on the page from the page content snapshot', ), }, handler: async (request, response, context) => { const uid = request.params.uid; const handle = await context.getElementByUid(uid); try { await context.waitForEventsAfterAction(async () => { await handle.asLocator().hover(); }); response.appendResponseLine(`Successfully hovered over the element`); response.setIncludeSnapshot(true); } finally { void handle.dispose(); } }, });