Skip to content

Commit 523179f

Browse files
authored
some changes
1 parent 9b8b255 commit 523179f

3 files changed

Lines changed: 31 additions & 30 deletions

File tree

support/power-platform/power-automate/desktop-flows/media/troubleshoot-unattended-runs-with-screenshots/failed-action-surronded-by-screenshot-actions.png renamed to support/power-platform/power-automate/desktop-flows/media/troubleshoot-unattended-runs-with-screenshots/failed-action-surrounded-by-screenshot-actions.png

File renamed without changes.

support/power-platform/power-automate/desktop-flows/media/troubleshoot-unattended-runs-with-screenshots/take-screnshot-action.png renamed to support/power-platform/power-automate/desktop-flows/media/troubleshoot-unattended-runs-with-screenshots/take-screenshot-action.png

File renamed without changes.
Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,67 @@
11
---
22
title: Troubleshoot failed unattended runs using screenshots
3-
description: Troubleshoot failed unattended runs using screenshots
3+
description: Provides troubleshooting steps to identify and resolve issues causing unattended runs to fail in Microsoft Power Automate.
44
ms.reviewer: alarnaud
55
ms.date: 05/07/2025
66
ms.custom: sap:Desktop flows\Unattended flow runtime errors
77
---
88
# Troubleshoot failed unattended runs using screenshots
99

10-
This article helps troubleshoot failed unattended runs using screenshots.
10+
This article provides guidance on troubleshooting failed unattended runs of scripts, particularly focusing on capturing screenshots to diagnose issues.
1111

1212
_Applies to:_   Power Automate
1313
_Original KB number:_   5007976
1414

1515
## Symptoms
1616

17-
A script that runs successfully in attended mode fails to execute properly in unattended mode. It may also fail with a message such as:
17+
A script that runs successfully in attended mode fails to execute properly in unattended mode. It might also fail with an error message like:
1818

1919
> There was a problem running the action 'Click'. The link could not be clicked on the web page.
2020
2121
## Cause
2222

23-
Failures in unattended runs are typically caused due to the following reasons:
23+
Unattended run failures might occur due to the following reasons:
2424

25-
- The script may not have been thoroughly tested in attended mode before being deployed in unattended mode.
26-
- The unattended session may use a different configuration compared to the attended session, such as a different Windows account, screen resolution, or browser settings (e.g., user profile, popup blocker settings, or missing/disabled extensions).
27-
- Screens may not load completely due to insufficient delays or timing issues in the script.
28-
- A UAC prompt may block UI automation when the session begins.
25+
- The script might not have been thoroughly tested in attended mode before being deployed in unattended mode.
26+
- The unattended session might use a different configuration compared to the attended session, such as a different Windows account, screen resolution, or browser settings (for example, user profile, popup blocker settings, or missing/disabled extensions.)
27+
- Screens might not completely load due to insufficient delays or timing issues in the script.
28+
- A User Account Control (UAC) prompt might block UI automation when the session begins.
2929

3030
## Resolution
3131

32-
As there could be different causes for this issue, the solution below describes a method of adding screenshots before and after a failing action to get some visual feedback. Analyzing the screenshots taken before and after the failure in unattended mode can help identify the root cause from the issues listed above. The solution also describes how to compare display resolution and scale settings between attended and unattended run executions.
32+
As there could be different causes for this issue, the following solution describes a method of adding screenshots before and after a failing action to get some visual feedback. Analyzing the screenshots taken before and after the failure in unattended mode can help identify the root cause from the issues listed previously. The solution also describes how to compare display resolution and scale settings between attended and unattended run executions.
3333

34-
If you've added screenshots in your flow and they fail to execute, you may have a User Account Control (UAC) dialog interfering with automation of your flow. Log in to the machine where the issue occurs using the same Windows account configured for the unattended flow execution, and check for any blocking dialogs. If you have such dialogs, adjust your startup configuration to prevent this issue.
34+
If you've added screenshots in your flow and they fail to execute, you might have a UAC dialog interfering with automation of your flow. Sign in to the machine where the issue occurs using the same Windows account configured for the unattended flow execution, and check for any blocking dialogs. If you have such dialogs, adjust your startup configuration to prevent this issue.
3535

3636
### Add screenshots to troubleshoot
3737

38-
To troubleshoot the issue, you can capture screenshots immediately before and after a failing step in unattended mode using the [Take screenshot](https://learn.microsoft.com/en-us/power-automate/desktop-flows/actions-reference/workstation#takescreenshotbase) action. The screenshots can provide visual feedback to help diagnose the issue. You can configure the failing step to continue on after the failure by modifying its 'On Error' behavior, allowing a screenshot to be captured after the failure occurs. After you identify and resolve the issue, revert the 'On Error' behavior of your flow to its original setting.
38+
You can capture screenshots immediately before and after a failing step in unattended mode using the [Take screenshot](/power-automate/desktop-flows/actions-reference/workstation#takescreenshotbase) action. The screenshots can provide visual feedback to help diagnose the issue. You can configure the failing step to continue on after the failure by modifying its "On error" behavior, allowing a screenshot to be captured after the failure occurs. Once the issue is resolved, revert the "On error" behavior of your flow to its original setting.
3939

40-
1. Log into the computer that reproduces the problem with the account you are using in your connection. Verify that there is no UAC prompt that may be blocking UI automation.
40+
1. Sign in to the computer that reproduces the problem with the account you're using in your connection. Verify that no UAC prompt is blocking UI automation.
4141

42-
1. Find the "Take screenshot" action.
42+
1. Locate the **Take screenshot** action.
4343

44-
:::image type="content" source="media/troubleshoot-unattended-runs-with-screenshots/take-screnshot-action.png" alt-text="Screenshot of the Take screenshot action under the Workstation section on the Actions page.":::
44+
:::image type="content" source="media/troubleshoot-unattended-runs-with-screenshots/take-screenshot-action.png" alt-text="Screenshot of the Take screenshot action under the Workstation section on the Actions page.":::
4545

46-
1. Drag and drop the "Take screenshot" action to the script side.
47-
1. Edit the action to **Save screenshot to:** File and specify a file name for the image with "before" in the file name. Select Save.
46+
1. Drag and drop the **Take screenshot** action into the script side.
4847

49-
:::image type="content" source="media/troubleshoot-unattended-runs-with-screenshots/screenshot-parameters-before.png" alt-text="Screenshot of the Take screenshot action settings.":::
48+
1. Set the **Save screenshot to:** field to **File** and specify a file path and name for the image, ensuring "before" is included in the file name. Select **Save**.
5049

51-
1. Add another "Take screenshot" action and specify a file name for the image (with "after" in the file name). Select Save.
50+
:::image type="content" source="media/troubleshoot-unattended-runs-with-screenshots/screenshot-parameters-before.png" alt-text="Screenshot of specifying a file name that includes "before" in the name.":::
5251

53-
:::image type="content" source="media/troubleshoot-unattended-runs-with-screenshots/screenshot-parameters-after.png" alt-text="Screenshot of the Take screenshot action settings.":::
52+
1. Add another **Take screenshot** action and specify a file path and name for the image, ensuring "after" is included in the file name. Select **Save**.
53+
54+
:::image type="content" source="media/troubleshoot-unattended-runs-with-screenshots/screenshot-parameters-after.png" alt-text="Screenshot of specifying a file name that includes "after" in the name.":::
5455

5556
1. Surround the failing action with the screenshot actions.
5657

57-
In this example the Launch new Microsoft Edge action is the failing action and is surrounded with the screenshot actions.
58+
In this example, the **Launch new Microsoft Edge** action is the failing action and is surrounded by the screenshot actions.
5859

59-
:::image type="content" source="media/troubleshoot-unattended-runs-with-screenshots/failed-action-surronded-by-screenshot-actions.png" alt-text="An example of a failed action surrounded by the screenshot actions.":::
60+
:::image type="content" source="media/troubleshoot-unattended-runs-with-screenshots/failed-action-surrounded-by-screenshot-actions.png" alt-text="An example of a failed action surrounded by the screenshot actions.":::
6061

61-
1. Change the **onError** behavior of the failing action.
62+
1. Change the "On error" behavior of the failing action:
6263

63-
1. Edit the failing action and click on **onError** at the bottom
64+
1. Edit the failing action and select the **On error** button at the bottom.
6465

6566
:::image type="content" source="media/troubleshoot-unattended-runs-with-screenshots/on-error-button.png" alt-text="Screenshot of the On error button on the failed action.":::
6667

@@ -70,15 +71,15 @@ To troubleshoot the issue, you can capture screenshots immediately before and af
7071

7172
1. Run the flow locally to verify that screenshots are produced.
7273
1. Launch the unattended run.
73-
1. Check screenshot files from the unattended run for clues to help identify the root cause of the issue.
74+
1. Check the screenshot files generated during the unattended run for clues to help identify the root cause of the issue.
7475

7576
### Check screen resolution and scale differences
7677

77-
Many UI automation issues are due to screen resolution differences between the machines running the attended and unattended sessions. Compare the resolution settings between attended and unattended run executions to ensure they match in both modes.
78+
Many UI automation issues arise due to screen resolution differences between the machines running the attended and unattended sessions. Compare the resolution settings between attended and unattended run executions to ensure they match in both modes.
7879

79-
In some instances (such as when using virtual machine (VM), hyper-V, etc.) the display resolution settings may not be visible or grayed out. As a workaround in such situations, you can add the following actions in your script before running in both modes.
80+
In some cases, such as when using a virtual machine (VM) or Hyper-V, the display resolution settings might be unavailable or grayed out. As a workaround in such situations, you can add the following actions in your script before running in both modes.
8081

81-
1. Copy/Paste the following code snippet into the Power Automate for desktop designer.
82+
1. Copy and paste the following code snippet into the [Power Automate desktop flow designer](/power-automate/desktop-flows/flow-designer).
8283

8384
```c#
8485
DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateAndTime CurrentDateTime=> CurrentDateTime
@@ -109,10 +110,10 @@ In some instances (such as when using virtual machine (VM), hyper-V, etc.) the d
109110
File.WriteText File: $'''c:\\test\\resolution_%FormattedDateTime%.txt''' TextToWrite: $'''height: %MonitorHeight% width: %MonitorWidth% frequency: %MonitorFrequency% bitCount: %MonitorBitCount% scale: %MonitorScaleOutput%''' AppendNewLine: True IfFileExists: File.IfFileExists.Overwrite Encoding: File.FileEncoding.Unicode
110111
```
111112

112-
This will create the following steps which will capture the resolution settings and output them in a timestamped file.
113+
The following screenshot illustrates the steps to capture resolution settings and output them in a timestamped file.
113114

114-
:::image type="content" source="media/troubleshoot-unattended-runs-with-screenshots/script-action.png" alt-text="Screenshot of the created steps.":::
115+
:::image type="content" source="media/troubleshoot-unattended-runs-with-screenshots/script-action.png" alt-text="Screenshot of the created steps.":::
115116

116-
1. Review the output file path from the last action, check that local execution is successful, and Save.
117+
1. Review the output file path from the last action, check that local execution is successful, and select **Save**.
117118

118119
1. Run the script in both attended and unattended modes, then compare the resolution and scale output to ensure they match in both modes.

0 commit comments

Comments
 (0)