Target creation and controlling the automation progress
When you analyze the user interactions intended for automated, you must consider the amount of time a web page spends loading or waiting for an application to respond. Some applications load quickly, while others do not; numerous factors can cause this variance, such as time of day, the number of users, and background application processing.
When automating actions that interact with applications, ensure the target pages or windows and their controls are available before your automation sends data or responds to the controls' events.
Pega Robot Studio provides properties, methods, and events to determine if targets are available to be automated.
You can start an automated process by using the Created event of the application window. In the following example, the design block that represents a Created event is used as a starting point of the automation. When the target window associated with the frmAccountingApp control fully loads and displays, the Created event is triggered and starts the automation.
Note: The Created event for any target is triggered when the control is matched. Navigating back to a previous page or window retriggers the Created event for all interrogated objects on that page or window, which may cause the unwanted start of another automation.
The WaitForCreate method sets up automation logic to wait until the Created event triggers for an object before proceeding to the next step of the automation. The method provides a Boolean result of the Created event. If the Created event occurs within the wait time, the automation continues through the True logic. If it does not occur within the wait time, the automation continues through the False logic. The Boolean logic provides the developer with an opportunity to manage the False logic with a custom message instead of relying on the system to generate an error.
All objects have an implicit wait of 30000 milliseconds (30 seconds) by default. For example, if control is not available for the automation, the automation waits 30 seconds by default before it attempts to continue the automation. To change the default amount of waiting time, use the WaitForCreate (1 parameter) method, or adjust it by using the Timeout property on the control.
For more information about advanced waiting logic, see Automation wait logic.
In the following example, after logging in to the accounting application, an automation waits until the Created event occurs for the main application window. If the event triggers within 30 seconds, automation proceeds with the client search; otherwise, it notifies the user about the timeout.
When automating an application, an automation developer should uniquely identify UI elements across multiple application instances, just as a user does. If the UI element is correctly matched on the currently displayed application window or a webpage, the IsCreated property for this control equals true. The IsCreated property is read-only and cannot be modified in automation.
Unlike the WaitForCreate method, the matching status for IsCreated property is evaluated upfront, without waiting for an application to load or refresh.
Check your knowledge with the following interaction.