To learn more about using JavaScript in LeanFT, see Setting up and working with the JavaScript SDK.
For JavaScript code samples, see Code Samples - JavaScript.

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:
Name Type Description
x Number The x-coordinate on the screen to place the mouse pointer.
y Number The y-coordinate on the screen to place the mouse pointer.
button MouseButton The 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:
Name Type Description
x Number The x-coordinate on the screen to place the mouse pointer.
y Number The y-coordinate on the screen to place the mouse pointer.
button MouseButton The 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:
Name Type Description
x Number The x-coordinate on the screen to place the mouse pointer.
y Number The y-coordinate on the screen to place the mouse pointer.
button MouseButton The 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:
Name Type Description
x Number The x-coordinate on the screen to place the mouse pointer.
y Number The y-coordinate on the screen to place the mouse pointer.
button MouseButton The 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:
Name Type Description
fromPoint Point The point from which to perform the drag and drop operation.
toPoint Point The point where the drag ends and the mouse button is released.
button MouseButton The 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:
Name Type Description
x Number The x-coordinate on the screen to place the mouse pointer.
y Number The 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>