Event handlers manage events that can occur at any time during the run of the script. The event trigger is set to an object or dialog appearing in the application with or without an additional specified property. The handler (action) of the event is a function selected from the script’s function libraries.
During the replay of the script, when moving from one step to the next, TruClient checks to see if a defined event occurs and if it does, it runs the function associated with the event.
The flowchart below illustrates the Event Handler workflow using the business process example of buying and selling of stocks.
Click the button from the TruClient sidebar.
What do you want to do?
This task describes how to create and use events with the Global Events Handler.
The Global Events Handler runs functions if a certain event occurs during the replay of the script. Before you create handlers, you must create the associated functions. For details, see .
- Create an Event Handler
Click the button from the TruClient Toolbar. This will open the Event Handler Editor
Click the button from the Event Handler pane.
Define the properties of the handler.
You can specify if you want the handler to run at any time during the script or only between certain steps. For details on this and other properties, see .
- Define object associated with event
Select the object in the application with the button on which the event will occur.
For example, select the text box for the widget StockPrice if you wish to trigger the function SellStock, if the stock prices rises over $99.99.
- Once the object is selected you can select the button to verify that the correct object was selected. Additionally, you can select the button to replace the selected object with another one. For details, see Resolve Object Identification Issues.
Define the event
You can select to run the handler if the object exists or if, object's properties meet specific conditions. For details, see .
Assign handler to the event
Select the function library, the function and specify argument values. For details, see .
Enable the handler
To enable the handler during script replay, select the check box next to the handler in the Event Handler Pane.
This dialog box enables you to define events handlers and their properties.
|Event Handler Pane||
Add Event Handler. Add an event to the event handler.
Delete Event Handler. Delete an event from the event handler.
You can select either:
Type. You can select either object or dialog.
If you select object, you need to specify the following: