MouseClass
class provides methods to emulate mouse input
class MouseClass extends TypedEventEmitter<MouseInputEvents, this>Properties
| Name | Type | Description |
|---|---|---|
config | MouseConfig | Config object for class(default: ...) |
Methods
click
click(btn: Button): Promise<MouseClass>clicks a mouse button
Parameters
Returns
Promise<MouseClass>doubleClick
doubleClick(btn: Button): Promise<MouseClass>performs a double click on a mouse button
Parameters
Returns
Promise<MouseClass>drag
drag(path: Point[] | Promise<Point[]>, options?: MousePathActionOptions): Promise<MouseClass>drags the mouse along a certain path
In summary, presses and holds the left mouse button, moves the mouse and releases the left button
Parameters
Returns
Promise<MouseClass>getPosition
getPosition(): Promise<Point>returns a representing the current mouse position
Returns
Promise<Point>leftClick
leftClick(): Promise<MouseClass>performs a click with the left mouse button
Returns
Promise<MouseClass>move
move(path: Point[] | Promise<Point[]>, movementType: EasingFunction = linear, options?: MousePathActionOptions): Promise<MouseClass>moves the mouse cursor along a given path of s, according to a movement type
Parameters
movementTypeEasingFunctionDefines the type of mouse movement. Would allow to configured acceleration etc. (Default: , no acceleration)options?MousePathActionOptionsOptional action options, e.g. an abort signal to cancel movementReturns
Promise<MouseClass>pressButton
pressButton(btn: Button): Promise<MouseClass>presses and holds a mouse button
Parameters
Returns
Promise<MouseClass>releaseButton
releaseButton(btn: Button): Promise<MouseClass>releases a mouse button previously pressed via
Parameters
Returns
Promise<MouseClass>rightClick
rightClick(): Promise<MouseClass>performs a click with the right mouse button
Returns
Promise<MouseClass>scrollDown
scrollDown(amount: number): Promise<MouseClass>scrolls down for a given amount of "steps"
Please note that the actual scroll distance of a single "step" is OS dependent
Parameters
amountnumberThe amount of "steps" to scrollReturns
Promise<MouseClass>scrollLeft
scrollLeft(amount: number): Promise<MouseClass>scrolls left for a given amount of "steps"
Please note that the actual scroll distance of a single "step" is OS dependent
Parameters
amountnumberThe amount of "steps" to scrollReturns
Promise<MouseClass>scrollRight
scrollRight(amount: number): Promise<MouseClass>scrolls right for a given amount of "steps"
Please note that the actual scroll distance of a single "step" is OS dependent
Parameters
amountnumberThe amount of "steps" to scrollReturns
Promise<MouseClass>scrollUp
scrollUp(amount: number): Promise<MouseClass>scrolls up for a given amount of "steps"
Please note that the actual scroll distance of a single "step" is OS dependent
Parameters
amountnumberThe amount of "steps" to scrollReturns
Promise<MouseClass>setPosition
setPosition(target: Point | Promise<Point>): Promise<MouseClass>instantly moves the mouse cursor to a given
Returns
Promise<MouseClass>Was this page helpful?