You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Troubleshoot failed unattended runs using screenshots
9
9
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.
11
11
12
12
_Applies to:_ Power Automate
13
13
_Original KB number:_ 5007976
14
14
15
15
## Symptoms
16
16
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:
18
18
19
19
> There was a problem running the action 'Click'. The link could not be clicked on the web page.
20
20
21
21
## Cause
22
22
23
-
Failures in unattended runs are typically caused due to the following reasons:
23
+
Unattended run failures might occur due to the following reasons:
24
24
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.
29
29
30
30
## Resolution
31
31
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.
33
33
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.
35
35
36
36
### Add screenshots to troubleshoot
37
37
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.
39
39
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.
41
41
42
-
1.Find the "Take screenshot" action.
42
+
1.Locate the **Take screenshot** action.
43
43
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.":::
45
45
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.
48
47
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**.
50
49
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.":::
52
51
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.":::
54
55
55
56
1. Surround the failing action with the screenshot actions.
56
57
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.
58
59
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.":::
60
61
61
-
1. Change the **onError**behavior of the failing action.
62
+
1. Change the "On error" behavior of the failing action:
62
63
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.
64
65
65
66
:::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.":::
66
67
@@ -70,15 +71,15 @@ To troubleshoot the issue, you can capture screenshots immediately before and af
70
71
71
72
1. Run the flow locally to verify that screenshots are produced.
72
73
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.
74
75
75
76
### Check screen resolution and scale differences
76
77
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.
78
79
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.
80
81
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).
0 commit comments