Desktop Automation That Survives 2am

Desktop Automation That Survives 2am

Build selectors on stable attributes, match the unattended machine's resolution and scaling, and leave a screenshot behind when a step fails.

power-automate rpa desktop-flows ui-selectors unattended reliability

What it is for

How to build a Power Automate desktop flow that keeps working on an unattended machine: selectors built on stable attributes with fallbacks, matching resolution and DPI scaling, and an error path that leaves a screenshot behind. Use it before promoting any recorded desktop flow to an unattended schedule. It prevents the classic element-not-found failure discovered hours after the run should have finished, with nothing in the log to debug from.

The skill

A desktop flow that works while you watch it is not a working desktop flow.
The unattended machine is a different machine. Build for that one.

Make selectors that do not depend on the picture:
- Prefer stable attributes - id, name, automation id - over position, index or
  visible text. A selector that means "the third button" breaks the day someone
  adds a button.
- Where the application exposes only weak attributes, add a fallback selector
  for the same element rather than betting everything on one.
- Never build a step on absolute screen coordinates unless there is genuinely
  no element to grab. Coordinates are a promise about resolution you cannot keep.

Match the environment that will actually run it:
- Give the unattended session the same screen resolution and display scaling as
  the machine you recorded on. Different DPI moves and hides elements, and a
  selector that worked yesterday finds nothing.
- Capture or repair selectors on the machine that runs the flow, not on your
  laptop, and test them there.
- Assume no human will dismiss anything. Handle the update prompt, the "restore
  session" banner and the licence nag explicitly.

Fail loudly:
- Wrap each fragile section in an error path that takes a screenshot and
  records the step name before it stops. Debugging a 2am failure without a
  screenshot is guesswork.
- Bound every wait for a UI element. A step that retries forever holds the
  machine and blocks the next scheduled run.
- Close the application at the end, including on the error path. A window left
  open is why tomorrow's run fails on its first step.

The failure this prevents: a "could not find the UI element" error, found at
9am, on a run that should have finished six hours earlier, with nothing in the
log but a step number.

How to install it

1. Open the tool and start a new conversation, project or template.
2. Paste the text below wherever the tool keeps standing instructions
   — usually called system prompt, instructions, or persona.
3. Save it so it applies to every run rather than a single message.

Did it work for you?

Where it came from

Skills app Original