Lupa API Reference / commands / sendMouse
Function: sendMouse()
sendMouse(
payload):Promise<void>
Defined in: src/commands/index.ts:147
Sends an action for the mouse to move it to a specific position or click a mouse button (left, middle, or right).
WARNING: When moving the mouse or holding down a mouse button, the mouse stays in this state as long as you do not explicitly move it to another position or release the button. For this reason, it is recommended to reset the mouse state with the resetMouse command after each test case manipulating the mouse to avoid unexpected side effects.
Parameters
payload
An object representing a mouse action specified by the type property (move, click, down, up) and including some properties to configure this action.
Returns
Promise<void>
A promise that resolves when the mouse events are sent.
Examples
await sendMouse({
type: 'move',
position: [100, 100]
}) await sendMouse({
type: 'click',
position: [100, 100],
button: 'right'
}) await sendMouse({
type: 'down'
})