TestComplete Tutorial 10 - Keystrokes
Using different keystroke methods, you can simulate keyboard input in your tests.
Different Methods are -
- SetText( ) - sets text in an edit control.
- Desktop.KeyDown( ) -
- Simulate pressing the specified key by its virtual code.
- This method is applied for Desktop objects.
- Desktop.KeyUp( ) -
- Simulate releasing the specified key by its virtual code.
- This method is applied for Desktop objects.
- OnscreenObject.Keys -
- Send key presses to the desired object.
- OnscreenObject Keys types in the specified onscreen object.
- Sys.Keys and Desktop.Keys -
- Send key presses to the desired object.
- Desktop.Keys and Sys.Keys type in the currently focused object.
Examples -
setText -
var userName = "name mapping for userName button";
userName .Keys("Admin");
KeyDown and KeyUp -
Sys.Desktop.KeyDown(65);
Sys.Desktop.KeyUp(65);
Keys -
Sys.Desktop.Keys("[F2]");
Comments
Post a Comment