Mouse

Mouse

new Mouse()

A class that enables low-level mouse operations.

Methods

buttonDown(x, y, button) → {Promise.<void>}

Presses the specified mouse button at the specified point on the screen.
Parameters:
NameTypeDescription
xnumberThe x-coordinate on the screen to place the mouse pointer.
ynumberThe y-coordinate on the screen to place the mouse pointer.
buttonMouseButtonThe mouse button used for the click operation.
Returns:
a promise that is fulfilled after pressing the mouse button at the specified point.
Type
Promise.<void>

buttonUp(x, y, button) → {Promise.<void>}

Releases the specified mouse button at the specified point on the screen.
Parameters:
NameTypeDescription
xnumberThe x-coordinate on the screen to place the mouse pointer.
ynumberThe y-coordinate on the screen to place the mouse pointer.
buttonMouseButtonThe mouse button used for the click operation.
Returns:
a promise that is fulfilled after releasing the mouse button at the specified point.
Type
Promise.<void>

click(x, y, button) → {Promise.<void>}

Moves the mouse to the specified point on the screen and clicks the left mouse button.
Parameters:
NameTypeDescription
xnumberThe x-coordinate on the screen to place the mouse pointer.
ynumberThe y-coordinate on the screen to place the mouse pointer.
buttonMouseButtonThe mouse button used for the click operation.
Returns:
a promise that is fulfilled after moving the mouse to the specified point on the screen and clicking the left mouse button.
Type
Promise.<void>

doubleClick(x, y, button) → {Promise.<void>}

Moves the mouse to the specified point on the screen and double-clicks the left mouse button.
Parameters:
NameTypeDescription
xnumberThe x-coordinate on the screen to place the mouse pointer.
ynumberThe y-coordinate on the screen to place the mouse pointer.
buttonMouseButtonThe mouse button used for the click operation.
Returns:
a promise that is fulfilled after moving the mouse to the specified point on the screen and double-clicking the left mouse button.
Type
Promise.<void>

dragAndDrop(fromPoint, toPoint, button) → {Promise.<void>}

Drags the mouse from and to the specified points while the left mouse button is pressed, and then releases the mouse button.
Parameters:
NameTypeDescription
fromPointPointThe point from which to perform the drag and drop operation.
toPointPointThe point where the drag ends and the mouse button is released.
buttonMouseButtonThe mouse button pressed during the drag operation.
Returns:
a promise that is fulfilled after dragging the mouse from and to the specified point while the left mouse button is pressed, and then releasing the mouse button.
Type
Promise.<void>

move(x, y) → {Promise.<void>}

Moves the mouse to the specified point on the screen.
Parameters:
NameTypeDescription
xnumberThe x-coordinate on the screen to place the mouse pointer.
ynumberThe y-coordinate on the screen to place the mouse pointer.
Returns:
a promise that is fulfilled after moving the mouse to the specified point.
Type
Promise.<void>