hubcap mouse
Move the mouse to specific viewport coordinates without clicking.
When to use
Move the mouse pointer to exact coordinates without triggering a click. Use hover to move to an element by CSS selector. Use clickat to move and click in one step.
Usage
hubcap mouse <x> <y> Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
x | float | Yes | X coordinate in pixels from the left edge of the viewport |
y | float | Yes | Y coordinate in pixels from the top edge of the viewport |
Flags
None.
Output
| Field | Type | Description |
|---|---|---|
x | number | The X coordinate the mouse moved to |
y | number | The Y coordinate the mouse moved to |
{"x":100,"y":200} Errors
| Condition | Exit code | Stderr |
|---|---|---|
| Invalid x coordinate | 1 | invalid x coordinate: ... |
| Invalid y coordinate | 1 | invalid y coordinate: ... |
| Chrome not connected | 2 | error: connecting to Chrome: ... |
| Timeout | 3 | error: timeout |
Examples
Move the mouse to the center of the viewport:
hubcap mouse 640 360 Move the mouse to trigger a hover effect at a specific point:
hubcap mouse 250 75 Move to an element’s position using bounds, then take a screenshot of the hover state:
pos=$(hubcap bounds '.tooltip-trigger' | jq -r '"\(.x) \(.y)"') && hubcap mouse $pos && hubcap screenshot hover.png