Skip to main content
Page mouse methods for the Playwright driver.

mouse.click

Shortcut for mouse.move(), mouse.down(), mouse.up().
Simulates a mouse click at the specified coordinates.
Upstream docs
x
number
required
X coordinate relative to the main frame viewport in CSS pixels.
y
number
required
Y coordinate relative to the main frame viewport in CSS pixels.
options
PlaywrightMouseClickOptions
Click options.
await page.mouse.click(0, 0);

mouse.dblclick

Shortcut for mouse.move(), mouse.down(), mouse.up(), mouse.down(), mouse.up().
Simulates a double mouse click at the specified coordinates.
Upstream docs
x
number
required
X coordinate relative to the main frame viewport in CSS pixels.
y
number
required
Y coordinate relative to the main frame viewport in CSS pixels.
options
PlaywrightMouseDblclickOptions
Double-click options.
await page.mouse.dblclick(0, 0);

mouse.down

Dispatches a mousedown event. Upstream docs
options
PlaywrightMouseDownUpOptions
Mouse down options.
await page.mouse.down();

mouse.up

Dispatches a mouseup event. Upstream docs
options
PlaywrightMouseDownUpOptions
Mouse up options.
await page.mouse.up();

mouse.move

Dispatches a mousemove event.
The steps option controls the number of intermediate mousemove events to generate.
Upstream docs
x
number
required
X coordinate relative to the main frame viewport in CSS pixels.
y
number
required
Y coordinate relative to the main frame viewport in CSS pixels.
options
PlaywrightMouseMoveOptions
Mouse move options.
await page.mouse.move(0, 0);

mouse.wheel

Dispatches a wheel event.
This method is usually used to manually scroll the page. Wheel events may cause scrolling if they are not handled, and this method does not wait for the scrolling to finish before returning.
Upstream docs
deltaX
number
required
Pixels to scroll horizontally.
deltaY
number
required
Pixels to scroll vertically.
await page.mouse.wheel(0, 0);