browser_hover
Simulate mouse hover over a specified webpage element using a CSS selector. Designed for automated web interactions with Chrome while evading bot detection mechanisms.
Instructions
Hover over an element on the page
Args:
selector: CSS selector for element to hover over - required
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"selector": "<selector>"
},
"name": "browser_hover"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes |
Implementation Reference
- The handler function for 'browser_hover' tool. It is registered via @mcp.tool() decorator. Takes a CSS selector, finds the element using Selenium, performs a hover action using ActionChains, and returns a success response.
@mcp.tool() async def browser_hover( selector: str, ): """Hover over an element on the page Args: selector: CSS selector for element to hover over - required """ assert selector, "Selector is required" async def hover_handler(driver: uc.Chrome): element = driver.find_element(By.CSS_SELECTOR, selector) ActionChains(driver).move_to_element(element).perform() return await create_success_response(f"Hovered over {selector}") return await tool.safe_execute( ToolContext(webdriver=await ensure_browser()), hover_handler )