IMouse Methods

Click

Overload List

Name

Description

Executes a defined sequence of MOUSE_DOWN & MOUSE_UP events to simulate a mouse click. The mouse is moved to the found position and a MOUSE_DOWN event, followed by a wait time defined in MouseClickDelay, followed by a MOUSE_UP event is executed.

Executes a defined sequence of MOUSE_DOWN & MOUSE_UP events to simulate a mouse click. The mouse is moved to the specified target position and a MOUSE_DOWN event, followed by a wait time defined in MouseClickDelay, followed by a MOUSE_UP event is executed.

Click(IEngineResult, MouseButton, Boolean, Nullable<Point>)

Executes a defined sequence of MOUSE_DOWN & MOUSE_UP events to simulate a mouse click. The mouse is moved to the found position and a MOUSE_DOWN event, followed by a wait time defined in MouseClickDelay, followed by a MOUSE_UP event is executed.

Syntax:

void Click(
	IEngineResult result,
	MouseButton mouseButton  = MouseButton.Left,
	bool withSlowApproach = true,
	Nullable<Point> positionOffset
)

Parameter

Description

result

Type: IEngineResult

IEngineResult used to position the mouse

[mouseButton]

Type: MouseButton

Mouse button to use for click. By default MouseButton.Left

[withSlowApproach]

Type: Boolean

If true, jumps from the current position to a position close to the result and then moves pixel by pixel to the result position before doing the click.

This simulates more closely how a human interacts with the mouse and is sometimes required to make sure the click is correctly registered by the target.

By default true

[positionOffset]

Type: Nullable<Point>

Additional offset applied to where image or text was found (in pixels). By default null

Click(Point, MouseButton, Boolean)

Executes a defined sequence of MOUSE_DOWN & MOUSE_UP events to simulate a mouse click. The mouse is moved to the specified target position and a MOUSE_DOWN event, followed by a wait time defined in MouseClickDelay, followed by a MOUSE_UP event is executed.

Syntax:

void Click(
	Point target,
	MouseButton mouseButton  = MouseButton.Left,
	bool withSlowApproach = true
)

Parameter

Description

target

Type: Point

Position where to click with the mouse

[mouseButton]

Type: MouseButton

Mouse button to use for click. By default MouseButton.Left

[withSlowApproach]

Type: Boolean

If true, jumps from the current position to a position close to the result and then moves pixel by pixel to the result position before doing the click.

This simulates more closely how a human interacts with the mouse and is sometimes required to make sure the click is correctly registered by the target.

By default true

Down

Overload List

Name

Description

Triggers a MOUSE_DOWN event on the subject under test

Triggers a MOUSE_DOWN event on the subject under test

Down(IEngineResult, MouseButton, Nullable<Point>)

Triggers a MOUSE_DOWN event on the subject under test.

Syntax:

void Down(
	IEngineResult result,
	MouseButton mouseButton = MouseButton.Left,
	Nullable<Point> positionOffset = null
)

Parameter

Description

result

Type: IEngineResult

IEngineResult used to position the mouse

[mouseButton]

Type: MouseButton

Mouse button to press. By default MouseButton.Left

[positionOffset]

Type: Nullable<Point>

Additional offset applied to where image or text was found (in pixels). By default null

Down(Point, MouseButton)

Triggers a MOUSE_DOWN event on the subject under test.

Syntax:

void Down(
	Point target,
	MouseButton mouseButton = MouseButton.Left
)

Parameter

Description

target

Type: Point

Position where press the mouse button

[mouseButton]

Type: MouseButton

Mouse button to press. By default MouseButton.Left

Move

Overload List

Name

Description

Moves the mouse to an absolute position on the subject under test

Moves the mouse to an absolute position on the subject under test

Move(IEngineResult, Boolean, Nullable<Point>)

Moves the mouse to an absolute position on the subject under test

Syntax:

void Move(
	IEngineResult result,
	bool withSlowApproach = false,
	Nullable<Point> positionOffset = null
)

Parameter

Description

result

Type: IEngineResult

IEngineResult used to position the mouse

[withSlowApproach]

Type: Boolean

Jumps from the current position to a position close to result and then moves pixel by pixel to the result position. False by default.

[positionOffset]

Type: Nullable<Point>

Additional offset applied to where image or text was found (in pixels). Not set by default.

Move(Point, Boolean)

Moves the mouse to an absolute position on the subject under test

Syntax:

void Move(
	Point target,
	bool withSlowApproach = false
)

Parameter

Description

target

Type: Point

Absolute position on the subject under test

[withSlowApproach]

Type: Boolean

Jumps from the current position to a position close to target and then moves pixel by pixel to the target position. False by default.

MoveOutOfScreen

Moves the mouse cursor of screen (on the right side, in the middle of the screen). If Properties.MouseMoveOutOffset is set, moves the mouse by this offset instead.

Syntax:

void MoveOutOfScreen()

MoveRelative

Moves the mouse relative to the current position on the subject under test

Syntax:

void MoveRelative(
	int x,
	int y,
	bool slowMove = true
)

Parameter

Description

x

Type: Int32

Vertical movement in pixels

y

Type: Int32

Horizontal movement in pixels

[slowMove]

Type: Boolean

If true the mouse moves slowly by the indicated offsets, otherwise it jumps directly to the new position. True by default.

ScrollWheel

Triggers a SCROLL mouse event on the subject under test. If target is set, the mouse first moves to the specified point on the SUT before doing the scrolling, otherwise scrolls at the current position.

Syntax:

void ScrollWheel(
	ScrollDirection direction,
	int increments = 1,
	Nullable<Point> target = null
)

Parameter

Description

direction

Type: ScrollDirection

scroll direction

[increments]

Type: Int32

amount of scroll moves (defined by the target operating system). By default 1.

[target]

Type: Nullable<Point>

Point at which the scroll should take place. By default not set.

Up

Overload List

Name

Description

Triggers a MOUSE_UP event on the subject under test

Triggers a MOUSE_UP event on the subject under test

Triggers a MOUSE_UP event on the subject under test

Up(IEngineResult, MouseButton, Nullable<Point>)

Triggers a MOUSE_UP event on the subject under test

Syntax:

void Up(
	IEngineResult result,
	MouseButton mouseButton = MouseButton.Left,
	Nullable<Point> positionOffset = null
)

Parameter

Description

result

Type: IEngineResult

IEngineResult used to position the mouse

[mouseButton]

Type: MouseButton

Mouse button to use for click. By default MouseButton.Left

[positionOffset]

Type: Nullable<Point>

Additional offset applied to where image or text was found (in pixels). By default null

Up(Point, MouseButton)

Triggers a MOUSE_UP event on the subject under test

Syntax:

void Up(
	Point target,
	MouseButton mouseButton = MouseButton.Left
)

Parameter

Description

target

Type: Point

Position where to release the mouse

[mouseButton]

Type: MouseButton

Mouse button to release. By default MouseButton.Left

Up(MouseButton)

Triggers a MOUSE_UP event on the subject under test

Syntax:

void Up(
	MouseButton mouseButton = MouseButton.Left
)

Parameter

Description

[mouseButton]

Type: MouseButton

Mouse button to release. By default MouseButton.Left

Last updated