跳到主要内容

Mouse

mouse.click

Signature: mouse.click(x, y, options?)

  • x <Horizontal position of the mouse.>
  • y <Vertical position of the mouse.>
  • options? <object>
    • button? <"left" | "right" | "middle"> Defaults to left.
    • clickCount? <number> defaults to 1. See UIEvent.detail.
    • delay? <number> Time to wait between mousedown and mouseup in milliseconds. Defaults to 0

Returns <Promise<void>>

Shortcut for mouse.move(x, y, options?), mouse.down(options?), mouse.up(options?).

mouse.dbclick

Signature: mouse.dbclick(x, y, options?)

  • x <Horizontal position of the mouse.>
  • y <Vertical position of the mouse.>
  • options? <object>
    • button? <"left" | "right" | "middle"> Defaults to left.
    • delay? <number> Time to wait between mousedown and mouseup in milliseconds. Defaults to 0

Returns <Promise<void>>

Shortcut for mouse.move(x, y, options?), mouse.down(options?), mouse.up(options?), mouse.down(options?) and mouse.up(options?).

mouse.down

Signature: mouse.down(options?)

  • options? <object>
    • button? <"left"|"right"|"middle"> Defaults to left.
    • clickCount? <number> defaults to 1. See UIEvent.detail.

Returns <Promise<void>>

Dispatches a mousedown event.

mouse.move

Signature: mouse.move(x, y, options?)

  • x <Horizontal position of the mouse.>
  • y <Vertical position of the mouse.>
  • options? <object> Optional object
    • steps? <number> Defaults to 1. Sends intermediate mousemove events.

Returns <Promise<void>>

Dispatches a mousemove event.

mouse.up

Signature: mouse.up(options?)

  • options? <object>
    • button? <"left"|"right"|"middle"> Defaults to left.
    • clickCount? <number> defaults to 1. See UIEvent.detail.

Dispatches a mouseup event.

Returns <Promise<void>>

mouse.wheel

Signature: mouse.wheel(deltaX, deltaY)

  • deltaX <number> Pixels to scroll horizontally.
  • deltaY <number> Pixels to scroll vertically.

Returns <Promise<void>>