UIActionSimulator is a class used to simulate user interface actions such as a mouse click or a key press.
Common usage for this class would be to provide playback and record (aka macro recording) functionality for users, or to drive unit tests by simulating user sessions.
See the for an example of using this class.
New in version 2.9.2.
__init__ | Default constructor. |
Char | Press and release a key. |
KeyDown | Press a key. |
KeyUp | Release a key. |
MouseClick | Click a mouse button. |
MouseDblClick | Double-click a mouse button. |
MouseDown | Press a mouse button. |
MouseDragDrop | Perform a drag and drop operation. |
MouseMove | Move the mouse to the specified coordinates. |
MouseUp | Release a mouse button. |
Text | Emulate typing in the keys representing the given string. |
UIActionSimulator is a class used to simulate user interface actions such as a mouse click or a key press.
Possible constructors:
UIActionSimulator()
Default constructor.
Press and release a key.
Parameters: |
|
---|---|
Return type: | bool |
Press a key.
If you are using modifiers then it needs to be paired with an identical KeyUp or the modifiers will not be released (MSW and OSX).
Parameters: |
|
---|---|
Return type: | bool |
Release a key.
Parameters: |
|
---|---|
Return type: | bool |
Click a mouse button.
Parameters: | button (int) – Button to press. See UIActionSimulator.MouseDown for a list of valid constants. |
---|---|
Return type: | bool |
Double-click a mouse button.
Parameters: | button (int) – Button to press. See UIActionSimulator.MouseDown for a list of valid constants. |
---|---|
Return type: | bool |
Press a mouse button.
Parameters: | button (int) – Button to press. Valid constants are MOUSE_BTN_LEFT , MOUSE_BTN_MIDDLE , and MOUSE_BTN_RIGHT . |
---|---|
Return type: | bool |
Perform a drag and drop operation.
Parameters: |
|
---|---|
Return type: | bool |
Overloaded Implementations:
MouseMove (self, x, y)
Move the mouse to the specified coordinates.
Parameters: |
|
---|---|
Return type: | bool |
MouseMove (self, point)
Move the mouse to the specified coordinates.
Parameters: | point (Point) – Point to move to, in screen coordinates. |
---|---|
Return type: | bool |
Release a mouse button.
Parameters: | button (int) – Button to press. See UIActionSimulator.MouseDown for a list of valid constants. |
---|---|
Return type: | bool |
Emulate typing in the keys representing the given string.
Currently only the ASCII letters, digits and characters for the definition of numbers (i.e. characters a-z A-Z 0-9 + - 'space' ) are supported.
Parameters: | text (string) – The string to type. |
---|---|
Return type: | bool |