In the previous article, we focused on the shape of decisions—how to build branches and control flow. This time, we’ll switch from structure to substance. In other words: what do we base our decisions on? In RPA, most condition checks fall into three simple types. Mastering them lets your automations sense the environment, understand content, and compare data before acting.
The three basic judgment types
Existence checks: “Does this thing exist?”
This is the most direct kind of decision. You’re asking whether an object is present right now.
What you evaluate: concrete objects such as files, folders, windows, UI elements, and images.
Typical commands: If file exists, If folder exists, If window exists, If web element is visible, If image exists.
Why it matters: Existence checks validate the environment before you proceed. They help you avoid brittle flows that break when a file is missing, a window hasn’t loaded, or a button is hidden. For example, before reading a CSV, confirm the file exists; before clicking a button, verify the element is visible. If the check fails, you can branch to a recovery path (retry, create the file, refresh the page) instead of crashing the process.
Think of existence checks as guardrails. They ensure your bot interacts only with what’s truly available, reducing errors and timeouts.
Containment checks: “Does this container include specific content?”
Here, you examine whether a larger surface contains something of interest.
What you evaluate: the relationship between a container (like a web page, window, or panel) and a target item (text, message, or element).
Typical commands: If web page contains, If window contains.
Why it matters: Containment checks are ideal for understanding state. Is there an error message on the page? Did a confirmation banner appear? Does a popup contain a specific keyword? These signals often determine the next branch—retry submission if you see “Timeout,” proceed if you see “Success,” or trigger a human handoff if you detect “Access denied.”
Use containment when your question is about presence within a context—content inside a page, labels inside a dialog, or an icon inside a panel.
Comparative (math/logical) checks: “How do these values relate?”
When your decision depends on data, you compare values.
What you evaluate: numbers, strings, dates, or any comparable data.
How it works: use comparison operators such as equals, not equals, greater than, less than, contains, starts with, before/after (dates), and pattern matches.
Why it matters: Comparative checks power business rules and control loops. Examples include: price >= threshold, stock < reorder level, date is before today, username contains “admin,” or JSON length > 0. They help you decide approvals, branching for exceptions, or when to continue/exit a loop.
Comparative logic is your workhorse for data-driven automation, turning rules into reliable flow control.
Fitting judgments into branch structures
A complete decision step combines two parts:
The branch structure you build (If/Else, Try/Catch with conditional recovery).
The judgment type you insert (existence, containment, or comparative).
You can visualize it as “shell + core.” The shell is your branching block; the core is the condition expression. When designing, start by asking: What exactly am I judging?
Is it an object? Use an existence check.
Is it content inside a surface? Use a containment check.
Is it a value or two values to compare? Use a comparative check.
This framing keeps conditions simple and readable. For example:
Before clicking “Submit,” confirm the “Submit” button exists (existence).
After submitting, check if the page contains “Success” (containment).
If successful, ensure totalAmount equals invoiceAmount (comparative).
Practical tips for reliable decisions
Stabilize your targets: For existence and containment checks, use robust selectors or image anchors. Avoid brittle identifiers that change on every load.
Set timeouts smartly: Give windows and elements time to appear. A short explicit wait can eliminate flaky failures.
Normalize data before comparing: Trim strings, unify case, and parse numbers/dates to avoid false mismatches.
Handle both branches: Always define what to do when the condition is false—retry, log, skip, or escalate.
Log decisions: Write concise logs like “Window not found—retrying (1/3).” This speeds up troubleshooting.
Bringing it all together
Once you see these three judgment types, you’ll spot them everywhere:
Environment readiness: If file exists, If window exists.
State recognition: If page contains “Invalid credentials”, If dialog contains a specific icon.
Rule enforcement: If balance >= amount, If dueDate < today, If text contains “urgent”.
Each condition becomes a clear sentence: check the world (existence), interpret the context (containment), compare the facts (comparative). Combined with a clean branch structure, they form decisions that are both understandable and resilient.
Summary
Existence, containment, and comparative checks are the backbone of decision-making in RPA. With them, your automations can sense what’s available, understand what’s on the screen, and compare data against business rules. Choose the judgment type based on your target—object, content, or value—and plug it into your branching structure. Do this consistently, and your bots will make smarter, safer decisions every step of the way.
