Skip to main content

Mouse Class

The Mouse class enables you to send mouse actions. It includes the following methods:

int ClickPause; // Pause in milliseconds following a mouse click
int DoubleClickPause; // Pause in milliseconds between clicks when double-clicking
void DoubleLeftClick(Point point);
void DoubleLeftClick(int x, int y);
void DoubleMiddleClick(Point point);
void DoubleMiddleClick(int x, int y);
void DoubleRightClick(Point point);
void DoubleRightClick(int x, int y);
void LeftClick(Point point);
void LeftClick(int x, int y);
void MiddleClick(Point point);
void MiddleClick(int x, int y);
void RightClick(Point point);
void RightClick(int x, int y);

Parameters

point: System.Drawing.point object specifying the location to perform the mouse action.

x: The screen X coordinate in pixels.

y: The screen Y coordinate in pixels

ClickPause: Time in milliseconds between clicks. Default = 10ms

DoubleClickPause: Time in milliseconds to wait following the second click. Default = 500ms

Remarks

Each WinDriver virtual user has a Mouse object that can be called from directly the scripts.

Example

notepadWindow = FindTopWindow("Untitled - Notepad");

// double click the title bar to maximise the window
Mouse.DoubleLeftClick(notepadWindow.X+50, notepadWindow.Y+5);