Hover / Click / Drag
hover_actionHover over an element, click another after hovering, or drag and drop onto a target using CSS selectors.
Instructions
Hover over an element, optionally click another, or drag-and-drop.
Use this tool for hover interactions, hover-triggered menus, and drag-and-drop operations.
Args: selector: The primary element selector. For action="hover", this is the element to hover over. For action="hover_and_click", this is the element to hover over before clicking 'secondary_selector'. For action="drag_and_drop", this is the draggable source element.
secondary_selector:
The secondary element selector.
Required for action="hover_and_click", where it identifies
the element to click after hovering 'selector'.
Required for action="drag_and_drop", where it identifies the
destination/drop target.
Not used for action="hover".
action:
- "hover": Hover over 'selector' only.
- "hover_and_click": Hover over 'selector', then click
'secondary_selector' after a short moment has passed.
- "drag_and_drop": Drag 'selector' and drop it onto
'secondary_selector'.
timeout: Maximum seconds to wait for 'selector'.
For drag_and_drop, the same timeout applies to secondary_selector.
For hover_and_click, SeleniumBase uses its own short wait for
secondary_selector; this parameter does not extend that secondary
wait.Returns: A confirmation message describing the performed operation's result.
Error behavior: If a required element cannot be found or interacted with within the applicable wait period, or if an error occurs during the action, the resulting exception message is returned through @handle_sb_errors. Failing actions such as failed hover_and_click will raise exceptions.
When not to use: - Do not use this tool to click if you don't need to hover an element before clicking another; use 'click' instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | No | hover | |
| timeout | No | ||
| selector | Yes | ||
| secondary_selector | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |