Skip to content

Lupa API Reference / commands / resetMouse

Function: resetMouse()

resetMouse(): Promise<void>

Defined in: src/commands/index.ts:170

Resets the mouse position to (0, 0) and releases mouse buttons.

Use this command to reset the mouse state after mouse manipulations by the sendMouse command.

Returns

Promise<void>

A promise that resolves when the mouse state is reset.

Example

it('does something with the mouse', () => {
  await sendMouse({ type: 'move', position: [150, 150] })
  await sendMouse({ type: 'down', button: 'middle' })
})

afterEach(() => {
  await resetMouse()
})