
- May 20, 2025
- SOAIS
- 0
Mastering the Keystroke Method in Test Automation
The Keystroke Method is an innovative approach to test automation that mimics actual user behaviour by capturing and replaying keyboard inputs and mouse actions. This technique is especially beneficial in scenarios where conventional object-based automation struggles with intricate or ever-changing user interfaces. By utilizing tools such as Worksoft Certify, the Keystroke Method effectively records user interactions during manual testing and replays them for automated testing, thereby ensuring a realistic simulation of user experiences.
Understanding the Keystroke Method
The Keystroke Method is a test automation strategy that replicates genuine user actions by recording and replaying keyboard and mouse inputs. It proves to be particularly advantageous when traditional object-based automation techniques encounter challenges in complex or dynamic user interface settings.
Implementing the Keystroke Method
- Selecting a Node in a Desktop Application – ABB AutoProd
To interact with a node in a desktop application, follow these steps:
- Create an Application: Choose the UIA (UI Automation) interface and integrate it into your project.
- Define a Process: Access the Process Editor and go to the Step tab.
- Insert Steps: Right-click and select “Insert Steps Below Using Live Touch.”
- Enable UIA: Activate the UIA option from the Enable tab in Certify Live Touch.
To execute the Keystroke Method:
Learn the nodes to identify the corresponding step.
- Utilize the Object ‘GeneralObject’ and Action ‘SelectNode’.
- Provide node path details using the Pipe (|) symbol.
- Set the Click Type to ‘Select’.
- Entering Values in Input Fields Using Keystrokes
The Keystroke Method facilitates the automation of text entry through simulated key presses.
- Window: Set to ‘Utilities’.
- Object: Choose ‘KeyboardAction’.
- Actions: Utilize ‘SendKeys’ or ‘Zkeys’.
Parameters:
- For SendKeys, specify the variable in the Keys field.
- For Zkeys, directly enter the relevant key inputs in the Keys field.
- Using Keystrokes to Move the Mouse Cursor
For applications that necessitate mouse movements to identify dynamic objects, follow these steps:
- Create a Dynamic Attribute: This aids in generating and storing an attribute string for recognizing dynamic objects within an application window.
- Assign the Dynamic Object: Link the attribute string to a dynamic UI element.
Steps in Process Editor:
- Open the Step Tab and select “Insert Steps Below Using Live Touch.”
- Enable UIA and learn the window to capture its structure.
- Set Action as Create Dynamic Attribute.
Configuring Parameters:
- Navigate to C:\Program Files (x86)\Worksoft\Certify\Interface Client Worksoft\ws Text UIA Worksoft.Interfaces.UIA.Extensibility Framework Tool.exe.
- Open Worksoft.Interfaces.UIA.Extensibility Framework Tool.exe.
- Select an Instance and provide details such as:
- Attribute String stored in a text variable.
- Collection Property Name set to Children.
- Scope defined as Member.
- Object Instance set to 1 (or Last for the most recent instance).
- Search Criteria configured using NativeType and NetName.
- Assigning Dynamic Objects and Mouse Click Actions
Once a Dynamic Attribute is established, assign it to an object using:
- Attribute String: Utilize the stored text variable.
- Dynamic Object Type: Set to GenericControl.
To execute a mouse click:
- Window: UIA Window.
- Object: GenericControl.
- Action: Mouse Click.
Parameters: Specify the mouse button, horizontal percentage, and vertical percentage for accurate positioning.