TestComplete Tutorial 10 - Keystrokes

 Using different keystroke methods, you can simulate keyboard input in your tests.

Different Methods are  - 

  1. SetText( ) - sets text in an edit control.
  2. Desktop.KeyDown( )
    • Simulate pressing the specified key by its virtual code. 
    • This method is applied for Desktop objects.
  3. Desktop.KeyUp( )
    • Simulate releasing the specified key by its virtual code. 
    • This method is applied for Desktop objects.
  4. OnscreenObject.Keys - 
    • Send key presses to the desired object. 
    • OnscreenObject Keys types in the specified onscreen object.
  5. 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

Popular posts from this blog

TestComplete Tutorial 9 - Mouse Actions and Mouse Wheel Events

TestComplete Tutorial 19 - Adding Objects to the Name Mapping Repository

TestComplete Tutorial 14 - Object identification criteria in Name Mapping