Use Case: Switch Windows
In this use case, a robot must complete work in several pop-up windows, including a pop-up window that is launched from another pop-up window. Explore how the window action supports this workflow.
Scenario
A robot completes the following tasks:
-
Opens a web application and completes a task that opens a pop-up window (child window 1).
-
Completes a task in child window 1. The task opens another pop-up window (child window 2).
-
Closes the two child windows, and returns to the main window.
Workflow
This workflow focuses on the steps that require the window action.
Task | More information |
---|---|
Create variables for storing the titles of the windows that the robot interacts with |
For example, create the following string variables to store the handles for the windows that the robot interacts with:
Additionally, create the following string collection variables to hold all window handles and titles:
See Create a Variable. |
Add actions that open the web application and open child window 1 |
Add robot actions as needed. |
Add a window action that switches the robot's focus to child window 1 |
The following action switches to child window 1 by specifying NEW for the Window Id. On the Output tab, the handle for the main window is saved to a variable. The variable lets the robot easily return to the main window later in the flow. See Add a Window Action. |
Interact with child window 1, prompting child window 2 to open |
Add robot actions as needed. |
Add a window action that switches the robot's focus from child window 1 to child window 2 |
The following action switches to child window 2 by specifying NEW for the Window Id. On the Output tab, the handle for child window 1 is saved to a variable. The variable lets the robot easily return to the window later in the flow. See Add a Window Action. |
Interact with child window 2 |
Add robot actions as needed. |
Get and log the window handles and titles of all the windows that the robot has interacted with up until now |
Add two window actions. The first action gets the handles and saves them in a string collection variable. The second action gets the titles and saves them in a string collection variable. See Add a Window Action. Additionally, add two log actions to log the values to the activity stream. See Add a Log Action. |
Close child window 2, and switch the focus to child window 1 |
Add two window actions. The first action closes child window 2. See Add a Window Action. The second action switches focus to child window 1 by specifying the variable for this window. |
Close child window 1, and switch the focus to the main window |
Add two window actions. The first action closes child window 1. See Add a Window Action. The second action switches focus to the main window by specifying its variable. |