Skip to main content
The Mouse class provides methods to simulate mouse interactions such as moving, clicking, and scrolling. Access the Mouse instance through page.mouse.

Methods

move

Moves the mouse to the specified position.
number
required
The x coordinate to move to
number
required
The y coordinate to move to
number
Number of intermediate steps to use when moving the mouse. Defaults to 1 (instant movement).

down

Presses a mouse button without releasing it.
'left' | 'right' | 'middle'
The button to press. Defaults to ‘left’.
number
Number of times the button is clicked. Defaults to 1.

up

Releases a mouse button.
'left' | 'right' | 'middle'
The button to release. Defaults to ‘left’.
number
Number of times the button is clicked. Defaults to 1.

click

Clicks at the specified position.
number
required
The x coordinate to click at
number
required
The y coordinate to click at
'left' | 'right' | 'middle'
The button to click. Defaults to ‘left’.
number
Number of times to click. Defaults to 1.
number
Time to wait between mousedown and mouseup in milliseconds. Defaults to 0.

dblclick

Double-clicks at the specified position.
number
required
The x coordinate to double-click at
number
required
The y coordinate to double-click at
'left' | 'right' | 'middle'
The button to click. Defaults to ‘left’.
number
Time to wait between clicks in milliseconds. Defaults to 0.

wheel

Scrolls the page using the mouse wheel.
number
required
Horizontal scroll amount in pixels
number
required
Vertical scroll amount in pixels

Example Usage

Drag and Drop

Context Menu

Scroll Page