Cloud Flow or Desktop Flow? The Decision in 5 Questions
Cloud flow or desktop flow? Here is how to decide in Power Automate when a legacy ERP without an API is involved.
Why selectors break in Power Automate Desktop, how to build them robustly, and how to use Wait actions for real wait times instead of fixed pauses.
When a UI automation built with Power Automate Desktop (PAD) suddenly fails with “Failed to get UI element” after weeks of running in production, that's almost never a coincidence. Usually something changed in the background that the selector can no longer find: an app update, a different screen resolution, a window that now takes a second longer to open than before. These two levers, robust selectors and clean wait times, decide whether a flow keeps running stably in unattended mode for months or has to be fixed manually every few days.
This guide shows you how selectors in PAD are built, which operators and variables make them dynamic, and how to replace fixed pauses with real synchronization using the right Wait actions. At the end you'll find a checklist to harden existing flows against the most common causes of failure.
A selector in Power Automate Desktop describes exactly where a UI element sits in the hierarchy of an application or a web page. According to Microsoft, selectors are created when PAD captures properties such as name, class, or automation ID, plus the element's position in the UI structure. That very capture is what makes selectors sensitive to change. In the troubleshooting guide for unattended desktop flows, Microsoft names, among others, the following factors that can invalidate a previously working selector:
If you know where a selector typically breaks, you can build it from the start to withstand these variations instead of reacting only after the first failure.
A selector consists of several levels chained together with the > character. Each level describes an element with its attributes in the form element[Attribut1="Wert1"][Attribut2="Wert2"]. A simple example from the documentation on building a custom selector shows an editor window: :desktop > window[Name="Notizen.txt - Editor"][Process="Notepad"]. The first level always starts with the root element :desktop, and every further level is a child of the previous one.
The default operator Equals looks for an exact, hard-coded value. That works reliably for static applications, but quickly becomes a problem once window titles change dynamically, for example through a file name or a timestamp in the title. Power Automate provides five further operators for this:
A window title like “Notizen.txt - Editor (2)” can be captured far more robustly with Starts with than with Equals, because the number in brackets at the end can vary without breaking the selector.
If an attribute value depends on a previous action, for example a file name that is only known at runtime, you can insert a variable into the selector using percent notation, such as :desktop > window[Name="%WindowName%"][Process="Notepad"]. That way the selector stays valid even when the expected value changes from run to run.
A single UI element can have several selectors in PAD. If the first one fails, Power Automate automatically moves on to the next in the defined order, with no extra step needed in your flow. Using the Selection with re-capture button, or by copying an existing selector, you can create additional variants, for example one using Equals for the normal case and one using Contains or Regex as a fallback.
For especially unstable interfaces, such as terminal sessions or legacy applications without a clean UI hierarchy, Microsoft's same guide also recommends the image fallback, where PAD relies on image recognition instead of UI attributes whenever a regular selector no longer works.
Fixed “Wait” actions with a set number of seconds are a common reason why flows either run unnecessarily slowly or still access an element too early. Power Automate Desktop offers dedicated synchronization actions for this, which wait for the actual state of the application instead of blindly letting a time span pass.
All three actions can be configured to fail with a timeout error once a defined time has passed, instead of waiting indefinitely. That matters for unattended flows, so a stuck window doesn't block the entire run but instead flows in a controlled way into error handling.
Before a flow goes into unattended operation, it's worth testing every critical selector directly in the Selector Builder. If a selector still breaks, the “Repair selector” feature offers quick first aid: you re-capture the element with Ctrl+left-click, PAD compares the old structure with the new one and suggests a repaired selector, which you can still review before accepting it. If a selector contains variables, automatic repair doesn't work according to Microsoft, and only manual adjustment in the Selector Builder's text editor remains.
For flows that are meant to run permanently without supervision, Microsoft summarizes several recommendations that have proven themselves in practice:
With this combination of robust selectors and real wait conditions, a flow runs into dead ends far less often. You stay in control of the process, because every action only starts once the application is actually ready for it, instead of setting off after an estimated wait time and hoping for the best. Anyone using Power Automate Desktop productively on a larger scale should plan these stability measures in from the start, for example as part of guided automation projects, rather than retrofitting them only after the first nightly failures.
A fixed wait time only estimates how long an application needs, but doesn't react to its actual state. If the application is faster, the flow wastes time unnecessarily; if it's slower, for example due to network load or a slow server, the next action tries to access an element that isn't there yet. Actions like Wait for window content or Wait for window instead check the application's real state and only continue once the condition is actually met.
Wait for window refers to the window as a whole, that is whether it opens, closes, gains focus, or loses focus. Wait for window content goes one level deeper and checks whether specific text or a specific UI element appears, disappears, or changes its enabled or disabled state inside an already open window. In practice you often combine both: wait for the window first, then for the actual content.
There's no fixed number, but Microsoft explicitly recommends storing several selectors per element so a fallback kicks in if the first one fails. In practice, two to three variants are enough for most elements, for example one with Equals for the normal case, one with Contains or Regex as a fallback, and for particularly unstable interfaces an additional image fallback.
No. According to Microsoft's documentation, the automatic repair function doesn't work for selectors that contain one or more variables. In that case you either have to temporarily replace the variables with static values to use the repair, or adjust the selector directly by hand in the Selector Builder's text editor.
If even a repaired selector with several fallback levels doesn't run stably, switching to the image fallback or to surface automation with mouse, keyboard, and OCR actions often helps, according to Microsoft, especially for applications without a clean UI hierarchy, for example in virtual desktop environments. It's also worth looking at the underlying cause: it's often a difference in screen resolution, DPI scaling, or window mode between the development environment and the unattended target machine.
Founder of NordFlux. Spent four years automating processes at enterprise scale at Dräger, and now brings that depth to the mid-market — pragmatic and with full data sovereignty.
Certifications
Cloud flow or desktop flow? Here is how to decide in Power Automate when a legacy ERP without an API is involved.
The Recorder in Power Automate Desktop captures clicks as flow actions. What it can do, how UIA and MSAA work, and where it hits its limits.
Copilot in Power Automate for Desktop creates, extends, and repairs desktop flows from a prompt, still with limitations around region and language.
Fixed pauses and fragile selectors are the most common reason unattended desktop flows fail overnight. We build your selectors with fallback strategies and real wait conditions, so flows run reliably even when interfaces change. On request, we also take on ongoing operation and troubleshooting afterward.