Desktop automation is often the only way to reach a system that will never get an API. It can work reliably, but only when the environment is controlled and the bot is designed to fail visibly rather than silently.
An attended or unattended bot that runs in an isolated environment, handles windows and waits predictably, secures credentials, and produces a failure record with a screenshot.
Step-by-step
-
Isolate the runtime environment
Run the bot on a dedicated virtual machine or a locked desktop with a fixed screen resolution and no other user sessions. Shared machines introduce pop-ups, focus changes, and locked screens that break UI automation. Isolation removes a whole class of intermittent failures.
Tip: Disable sleep, automatic updates during run windows, and notification pop-ups on the bot machine.
-
Record the exact steps, including waits
Walk through the process once and capture every window, field, and button, plus how long each screen takes to load. Do not rely on fixed sleeps alone; identify a stable element that confirms the screen is ready before the next action.
Tip: Record the slowest observed load time and use element-based waits with a generous timeout.
-
Choose resilient selectors
Prefer accessibility IDs, names, or automation properties over screen coordinates. Coordinates break when the window moves or the resolution changes. If the app offers no stable selectors, document the fallback and expect more maintenance.
Tip: Avoid selecting by visible text unless the text is stable across languages and versions.
-
Secure credentials properly
Store credentials in a vault or the RPA platform’s credential store, never in the script. Use a dedicated service account with only the permissions the process needs. Rotate the password on a schedule and test the bot after rotation.
Tip: Do not let the bot type a password into a field it then logs. Redact secrets from screenshots.
-
Design for visible failure
When an expected element is missing or a value is wrong, stop, capture a screenshot, and write a structured error with the step name and record ID. A bot that continues past an error is worse than one that stops.
Tip: Include the current record identifier in every log line so a failure can be traced to a specific item.
-
Decide attended versus unattended
Unattended runs need a machine that never locks and a process that can recover from a restart. Attended runs keep a person nearby for exceptions. Choose based on how often the process hits unexpected screens, not on ambition.
Tip: Start attended. Move to unattended after a month of clean runs and a tested recovery procedure.
-
Put the bot under change control
Version the automation, document each change, and re-test after any application update. Treat the bot like production software. When the legacy app changes, the bot should fail in a known place, not in a mysterious one.
Tip: Schedule a monthly smoke test even when nothing appears to have changed.
Common questions
Can a bot run while someone uses the computer?
It can, but reliability drops sharply. Use a dedicated session or virtual desktop for anything beyond a simple attended task.
What happens when the legacy app updates?
The bot should stop at the changed screen and log a clear error. Then update the selector and re-test before resuming.
Is screen scraping ever acceptable?
Only as a last resort, and only with a stable layout and a documented owner. Prefer accessibility properties or exported reports when available.