RPA Tutorial: Close Window vs. Close Application vs. Kill Process Activities

person wearing headphones on laptop

Many UiPath developers use the Robotic Enterprise Framework (REFramework) for their automations. Regardless of their choice for standard or customized processes, this framework is reliable because it already includes many of the best practices for successful automation. 

Yet, when it comes to the part where applications, browsers, etc. need to be closed, developers have three activity options:

1. Close window 

2. Close application 

3. Kill process 

These options often lead to questions about the best approach and the most appropriate activity to use. 

To start, we need to clarify that each of the options has unique behavior and their own set of pros and cons. To help clarify this, the below table provides two examples for each activity. To make it really easy, the examples cover an app and a web browser scenario.

windows app scenario screenshot 1

Follow the below steps to close any application or browser which displays a Prompt/Dialog interrupting closure. 

Note: this is an example inspired by the Windows application scenario discussed in the table above.

CloseExcelApp screenshot

You can use the CloseAllApplications.xaml of REFramework or other suitable workflows from your project. The main principle is to use the Close Window activity in combination with the Element Exists activity.

Approach: 

  • The Element Exists activity has a default timeout set to 3000 milliseconds (three seconds). This is the standard value for UiPath Studio version 2019.4.2 but it can be changed based on your knowledge of the application’s behavior. It is going to wait up to three seconds for the Prompt/Dialog window to be displayed. If it shows up, the Output for Element Exists activity will be set as True, otherwise, it will be marked as False.

  • The Output is received in a variable, e.g. promptExists, which is then checked using the Flow Decision activity.

  • If the value of the promptExists variable is True a Click activity is used. This will click the Save button on the Prompt/Dialog window and complete the application closure process. 

If the above flow cannot be used, the Close Application activity is the next best option. It has a default timeout of 30 seconds that can be adjusted as needed. 

Knowing exactly how to use activities that seem similar is an important step in mastering your UiPath Studio automations. 

My advice is to immerse yourself in all the available activities packs and keep in mind that only the sky is the limit.

Avatar Placeholder Big
Sagar Agrawal

RPA technical architect, UiPath