Interface IMouse
- Namespace
- Microsoft.Playwright
- Assembly
- Microsoft.Playwright.dll
The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.
Every page
object has its own Mouse, accessible with Mouse.
await Page.Mouse.MoveAsync(0, 0);
await Page.Mouse.DownAsync();
await Page.Mouse.MoveAsync(0, 100);
await Page.Mouse.MoveAsync(100, 100);
await Page.Mouse.MoveAsync(100, 0);
await Page.Mouse.MoveAsync(0, 0);
await Page.Mouse.UpAsync();
public interface IMouse
Methods
ClickAsync(float, float, MouseClickOptions?)
Shortcut for MoveAsync(float, float, MouseMoveOptions?), DownAsync(MouseDownOptions?), UpAsync(MouseUpOptions?).
Task ClickAsync(float x, float y, MouseClickOptions? options = null)
Parameters
x
floaty
floatoptions
MouseClickOptionsCall options
Returns
DblClickAsync(float, float, MouseDblClickOptions?)
Shortcut for MoveAsync(float, float, MouseMoveOptions?), DownAsync(MouseDownOptions?), UpAsync(MouseUpOptions?), DownAsync(MouseDownOptions?) and UpAsync(MouseUpOptions?).
Task DblClickAsync(float x, float y, MouseDblClickOptions? options = null)
Parameters
x
floaty
floatoptions
MouseDblClickOptionsCall options
Returns
DownAsync(MouseDownOptions?)
Dispatches a mousedown
event.
Task DownAsync(MouseDownOptions? options = null)
Parameters
options
MouseDownOptionsCall options
Returns
MoveAsync(float, float, MouseMoveOptions?)
Dispatches a mousemove
event.
Task MoveAsync(float x, float y, MouseMoveOptions? options = null)
Parameters
x
floaty
floatoptions
MouseMoveOptionsCall options
Returns
UpAsync(MouseUpOptions?)
Dispatches a mouseup
event.
Task UpAsync(MouseUpOptions? options = null)
Parameters
options
MouseUpOptionsCall options
Returns
WheelAsync(float, float)
Dispatches a wheel
event. This method is usually used to manually scroll
the page. See scrolling
for alternative ways to scroll.
Task WheelAsync(float deltaX, float deltaY)
Parameters
Returns
Remarks
Wheel events may cause scrolling if they are not handled, and this method does not wait for the scrolling to finish before returning.