Power Automate Desktop UI Automation: Troubleshooting Application Crashes

Table of Contents

Power Automate Desktop UI Automation: Troubleshooting Application Crashes

Desktop application crashes during the execution of UI automation within Power Automate for desktop can be a significant obstacle for process automation. These unexpected disruptions can halt critical workflows, leading to data loss and operational inefficiencies. Understanding the underlying causes and implementing effective workarounds is crucial for maintaining the stability and reliability of automated processes. This article delves into a specific issue that may trigger desktop application crashes when utilizing Power Automate for desktop’s UI automation capabilities and provides a detailed workaround to mitigate these occurrences.

Prerequisites

Before implementing the workaround, it is essential to ensure that your Power Automate for desktop environment meets the necessary prerequisites. Specifically, this solution is designed for users who are running Power Automate for desktop version 2.42 or later. Verifying the version of Power Automate for desktop installed on your machine is a critical first step. To check your version, navigate to the “Settings” menu within the Power Automate Desktop application and look for the “About” section, where the version number will be clearly displayed. Using an updated version ensures compatibility with the described workaround and incorporates the latest features and bug fixes.

Symptoms

Identifying the symptoms is the first step towards diagnosing and resolving application crashes in Power Automate Desktop UI Automation. Two primary symptoms indicate that the described issue might be affecting your automated processes.

  • Crash during UI Element Hover: When initiating the Power Automate for desktop recorder or utilizing the UI element picker, attempting to hover the mouse cursor over a UI element within a specific desktop application might lead to an immediate crash of that application. This symptom points towards a conflict arising from the interaction between Power Automate Desktop’s UI automation engine and the target application’s UI elements during the element identification phase.

  • Crash during UI Automation Action Execution: Another critical symptom occurs when a UI automation action is actively being executed and interacting with a UI element in a specific desktop application. In this scenario, the desktop application unexpectedly crashes during the automation process. This indicates that the issue is not just limited to the element picking phase but can also manifest during the runtime execution of automation workflows, disrupting operations and potentially leading to data inconsistencies.

These symptoms are crucial indicators that the described workaround, involving configuration file modification, might be necessary to stabilize your Power Automate Desktop UI automation processes.

Workaround

To address the desktop application crashes encountered during UI automation, a practical workaround involves creating a configuration file within the Power Automate for desktop installation directory. This configuration file will contain specific key-value pairs designed to disable the monitoring of element focus changes and window state changes on the desktop. By deactivating these monitoring features, potential conflicts between Power Automate Desktop and certain desktop applications can be effectively resolved, thereby preventing crashes.

Before Creating the Configuration File

Prior to creating and implementing the configuration file, it is imperative to ensure that Power Automate for desktop and all its associated components are completely shut down and not running in the background. This is a crucial step to prevent any file access conflicts and to ensure that the configuration changes are applied correctly upon the next application startup.

To verify that Power Automate for desktop is fully closed, utilize the Task Manager. Open Task Manager by pressing Ctrl + Shift + Esc or by right-clicking on the Windows taskbar and selecting “Task Manager”. Once Task Manager is open, navigate to the Details tab. Within the Details tab, sort the list of processes alphabetically by name by clicking on the “Name” column header. Carefully examine the process list and confirm that no processes related to “Power Automate” are currently active or running. This step is essential to guarantee a clean and successful application of the configuration file workaround.

How to Create the Configuration File

The process of creating the configuration file is straightforward and involves navigating to the Power Automate for desktop installation folder and creating a new file with specific content. Follow these step-by-step instructions:

  1. Open File Explorer. You can do this by clicking on the File Explorer icon on your taskbar or by pressing Windows key + E.

  2. In the File Explorer address bar, type or paste the following path: %LOCALAPPDATA%\Microsoft\Power Automate Desktop and press Enter. This command will directly take you to the Power Automate Desktop local application data folder, regardless of the specific installation drive.

  3. Once inside the “Power Automate Desktop” folder, check for the existence of a subfolder named Configurations. If the “Configurations” folder is already present, proceed to the next step. If it does not exist, you need to create it manually. To create the folder, right-click in an empty area within the “Power Automate Desktop” folder, select New, and then click on Folder. Name the new folder exactly as Configurations.

  4. Open the newly created or existing Configurations folder. Inside this folder, you need to create a new file. Right-click in an empty area within the “Configurations” folder, select New, and then click on Text Document. Rename the new text file to UIAutomation.config. It is important to change the file extension from .txt to .config. Windows might display a warning about changing file extensions; confirm the change by clicking Yes.

  5. Open the UIAutomation.config file with a text editor such as Notepad. Right-click on the file, select Open with, and choose Notepad or your preferred text editor.

  6. Copy the following XML code block and paste it directly into the UIAutomation.config file. This XML structure provides the framework for configuring application settings. Within the <appSettings> section, you will add the key-value pairs to disable specific monitoring events.

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
          <appSettings>
              <!-- Please add here the key values for the configuration. See examples below:
    
              <add key="UIA3.DisableFocusEvent" value="true" />
    
              <add key="UIA3.DisableWindowStateEvent" value="true" />
    
               -->
          </appSettings>
    </configuration>
    
  7. Modify the XML configuration by adding the necessary key-value pairs within the <appSettings> section. To implement the workaround for application crashes, you will typically add the following lines within the <appSettings> tags, as shown in the example comments in the default configuration:

    <add key="UIA3.DisableFocusEvent" value="true" />
    <add key="UIA3.DisableWindowStateEvent" value="true" />
    

    Your final UIAutomation.config file should resemble the following structure:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
          <appSettings>
              <add key="UIA3.DisableFocusEvent" value="true" />
              <add key="UIA3.DisableWindowStateEvent" value="true" />
          </appSettings>
    </configuration>
    
  8. After adding the key-value pairs, save the file. In Notepad, click on File in the menu bar and then select Save. Ensure that the file is saved as UIAutomation.config in the Configurations folder.

  9. Close the text editor.

  10. Restart Power Automate for desktop. After saving the configuration file, you can now reopen Power Automate for desktop. The application will now read the configuration file upon startup, and the specified settings to disable focus and window state event monitoring will be applied.

By following these steps precisely, you will have successfully created and implemented the configuration file workaround, which should effectively address the application crashes related to UI automation in Power Automate Desktop.

Key Values Editing

The UIAutomation.config file leverages key-value pairs to control specific aspects of Power Automate Desktop’s UI automation behavior. Understanding the available keys and their effects is essential for customizing the configuration to suit specific automation needs and troubleshoot potential issues. Two primary keys are relevant to addressing application crashes:

  • UIA3.DisableFocusEvent: This key controls whether Power Automate for desktop monitors element focus changes on the desktop. The “focus event” refers to the event triggered when a UI element gains or loses focus (becomes active or inactive). Disabling the monitoring of focus-changed events can be particularly helpful in resolving application crash issues that are triggered by focus-related interactions during UI automation.

    • Possible Values:
      • true: Setting the value to true disables the focus event monitoring. Power Automate for desktop will no longer track when UI elements gain or lose focus.
      • false (default): Setting the value to false or omitting the key from the configuration file keeps the focus event monitoring enabled. This is the default behavior of Power Automate for desktop when no configuration file is present or when this key is not explicitly defined.
  • UIA3.DisableWindowStateEvent: This key manages the monitoring of window state changes by Power Automate for desktop. Window state changes encompass events such as window minimization, maximization, restoration, or activation. Disabling the monitoring of window state change events can be beneficial in resolving application crash issues that stem from conflicts arising during window state manipulations within UI automation workflows.

    • Possible Values:
      • true: Setting the value to true disables the window state change event monitoring. Power Automate for desktop will not track window minimization, maximization, or other state changes.
      • false (default): Setting the value to false or not including this key in the configuration file maintains the default behavior, where window state change events are actively monitored by Power Automate for desktop.

By strategically setting these key values to true, you can effectively reduce the overhead of event monitoring, potentially resolving conflicts with certain applications that are sensitive to focus or window state change events during UI automation. It is important to note that disabling these events might have subtle implications for certain automation scenarios that rely on focus or window state awareness. However, for troubleshooting application crashes, disabling these monitoring features often provides a robust and effective solution.

Sample XML Configuration File

For quick reference, the following XML code block presents a complete sample of the UIAutomation.config file with both UIA3.DisableFocusEvent and UIA3.DisableWindowStateEvent keys set to true. This configuration is recommended as a starting point for addressing application crashes during UI automation.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
      <appSettings>
          <add key="UIA3.DisableFocusEvent" value="true" />
          <add key="UIA3.DisableWindowStateEvent" value="true" />
      </appSettings>
</configuration>

This sample configuration can be directly copied and pasted into the UIAutomation.config file as described in the “How to create the configuration file” section. Remember to save the file in the correct location and restart Power Automate for desktop for the changes to take effect.

By implementing this workaround, you can significantly improve the stability of your Power Automate Desktop UI automation processes and mitigate application crashes, ensuring smoother and more reliable automation workflows.

If you continue to experience issues or have further questions, consider exploring the Power Automate community forums or contacting Microsoft support for more specialized assistance. Feel free to share your experiences or ask questions in the comments below!

Post a Comment