Skip to content

Commit 54951af

Browse files
authored
Merge pull request #10256 from iomimtso/wrong-ui-element-clicked-populated
AB#8475: Wrong UI element is clicked or populated in desktop flow
2 parents ef6ab7e + f0c65fb commit 54951af

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: Troubleshoot Incorrect UI Element Clicked or Populated in Desktop Flow
3+
description: Resolve issues in Power Automate of desktop targeting the wrong UI element during automation. Learn how to ensure accurate clicks and text population.
4+
ms.reviewer: iomimtso, nimoutzo, v-shaywood
5+
ms.date: 11/26/2025
6+
ms.custom: sap:Desktop flows\UI or browser automation
7+
---
8+
# Wrong UI element is clicked or populated in desktop flow
9+
10+
This article resolves an issue in which Power Automate for desktop interacts with the wrong UI element instead of the element that you captured during flow design. This issue occurs even though the [Test Selector](/power-automate/desktop-flows/test-selectors) tool detects the right element.
11+
12+
## Symptoms
13+
14+
When you run a desktop flow that includes UI automation actions such as [Click UI element in window](/power-automate/desktop-flows/actions-reference/uiautomation#click) or [Populate text field in window](/power-automate/desktop-flows/actions-reference/uiautomation#populatetextfield), the flow interacts with a different UI element than the one that you originally captured.
15+
16+
You might observe the following symptoms:
17+
18+
- The action runs without errors but targets an unexpected element.
19+
- The wrong element receives the click or text input during runtime.
20+
- The [Test Selector](/power-automate/desktop-flows/test-selectors) tool successfully identifies the correct element during design time.
21+
22+
## Cause
23+
24+
This issue occurs because the target application handles focus, enable, or disable events in an unexpected way. Some applications dynamically change element focus or states. This functionality can cause UI automation actions to interact with the wrong element.
25+
26+
## Solution
27+
28+
To resolve this issue, use a combination of UI automation and mouse and keyboard actions to ensure proper element targeting. Use one of the following methods based on whether you have to click or populate text.
29+
30+
### Click an element by using hover and mouse click
31+
32+
Instead of using the [Click UI element in window](/power-automate/desktop-flows/actions-reference/uiautomation#click) action, follow these steps:
33+
34+
1. Add a [Hover mouse over UI element in window](/power-automate/desktop-flows/actions-reference/uiautomation#hoveronelement) action, and select the target UI element.
35+
1. Add a [Send mouse click](/power-automate/desktop-flows/actions-reference/mouseandkeyboard#sendmouseclick) action, placed immediately after the hover action, to click the element.
36+
37+
To prevent focus-related issues, this approach makes sure that the element receives focus through the hover action before the click is sent.
38+
39+
### Populate a text field by using focus and send keys
40+
41+
Instead of using the [Populate text field in window](/power-automate/desktop-flows/actions-reference/uiautomation#populatetextfield) action, follow these steps:
42+
43+
1. Add a [Focus text field in window](/power-automate/desktop-flows/actions-reference/uiautomation#focustextfield) action, and select the target text field.
44+
1. Add a [Send keys](/power-automate/desktop-flows/actions-reference/mouseandkeyboard#sendkeys) action to input the desired text.
45+
46+
To make sure that text is entered in the intended field, this approach explicitly sets the focus to the correct text field before the keystrokes are sent.

support/power-platform/power-automate/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ items:
113113
href: desktop-flows/ui-automation/element-picker-cant-see-elements.md
114114
- name: UIPI issues with UI and web automation actions
115115
href: desktop-flows/ui-automation/uipi-issues.md
116+
- name: Wrong UI element is clicked or populated in desktop flow
117+
href: desktop-flows/ui-automation/wrong-ui-element-clicked-populated.md
116118
- name: '"Could not read the application certificate" error when creating a connection'
117119
href: desktop-flows/application-certificate-error.md
118120
- name: Agent-related errors when running attended or unattended desktop flows

0 commit comments

Comments
 (0)