Summary
In automated RPA (Robotic Process Automation) workflows, relying solely on the visual presence of icons (like a green checkmark or a red X) to determine process success is a common pitfall for beginners. While visually intuitive for humans, these elements are often dynamic images or SVG elements that are difficult to interact with using standard selector-based logic. The robust engineering approach is to shift from visual pattern recognition to data-driven validation.
Root Cause
The issue arises because UI automation tools like Power Automate Desktop (PAD) interact with the Document Object Model (DOM) or the Accessibility Tree, rather than “seeing” pixels like a human.
- Dynamic UI Rendering: Success/failure icons are often rendered as high-level graphics or font-based icons that do not have unique, stable text identifiers.
- Lack of Semantic Meaning: An icon element often contains no text content in its properties, only a class name (e.g.,
class="icon-success") which may change during software updates. - Race Conditions: The icon might appear only after an asynchronous process completes, leading to a “Element Not Found” error if the automation checks too early.
Why This Happens in Real Systems
In enterprise-grade software, UI states are often decoupled from the underlying business logic. A developer might change the UI framework (from WinForms to WPF or React), which completely alters how an icon is represented in the accessibility tree, even if the underlying business logic remains identical. Relying on a “red X” makes your automation brittle and highly susceptible to regression errors during application updates.
Real-World Impact
- Flaky Automations: The flow fails not because the business process failed, but because the icon’s CSS class changed slightly.
- High Maintenance Overhead: Senior engineers spend hours fixing “false negative” alerts caused by UI changes.
- False Positives: An automation might assume success simply because a “loading” icon disappeared, even if a failure occurred.
Example or Code
Instead of searching for an image, use the “Get Details of UI element in window” action to check for a status text or a specific attribute that is part of the application’s data layer.
# Logical pseudocode for a robust check
IF Get UI Element Attribute ("Status_Text_Field") EQUALS "Success"
LOG "Process Completed Successfully"
PROCEED to next step
ELSE IF Get UI Element Attribute ("Status_Text_Field") EQUALS "Error"
LOG "Process Failed"
HANDLE error
ELSE
LOG "Process is still running or in unknown state"
WAIT 5
END
How Senior Engineers Fix It
Senior engineers implement Defensive Automation Patterns. Instead of looking for the icon, we use one of these three methods:
- DOM/Attribute Inspection: Look for a stable attribute like
aria-label="Success"orvalue="Completed". - State-Based Validation: Check the underlying data. If a process succeeds, a database record should be updated or a specific file should be created. Verifying the side effect is 100% more reliable than verifying the icon.
- Error Handling Blocks: Wrap the core action in an “On Error” block. If the action triggers a system exception, it is a failure. If no exception occurs and the expected data output is present, it is a success.
Why Juniors Miss It
- Human-Centric Thinking: Juniors tend to automate exactly how a human sees the screen (Visual-driven) rather than how the machine sees the data (Data-driven).
- Lack of Experience with Brittle Selectors: Beginners often use the “Recorder” feature, which captures the most literal (and often most fragile) UI path possible.
- Ignoring Side Effects: Juniors often focus on “did the screen change?” rather than “did the business requirement get fulfilled?”