Wait
Pauses the flow for a fixed amount of time.
Purpose
Holds the flow for a set number of milliseconds — to let an animation finish, a screen settle, or a network call return before the next step.
It is a plain timer. It does not look at the screen.
When to use it
- Letting an animation or transition complete before reading the screen.
- Settling the display after a Swipe or Zoom.
- Deliberately pacing a flow so it does not act at machine speed.
When not to use it
- To wait for something to appear. A Find Image or Check Region with a timeout does that properly: it returns the instant the thing shows up instead of always burning the full delay.
- As a fix for flakiness. A Wait that "usually works" is a race condition with extra steps.
Wait for a condition when one exists. Wait for time only when nothing observable marks the end of the thing you are waiting for.
Requirements
None. Wait runs without a connected device.
How it runs
- Validate the duration (50–120000 ms).
- In random mode, pick a uniform integer delay between the min and max for this execution.
- Sleep in small cancellable chunks so a Stop takes effect promptly.
- If the run is cancelled during the wait, route Cancelled; otherwise route Success and report the actual time waited.
The chunked sleep is why a 60-second Wait does not block you from stopping a run.
Settings
| Setting | Type | Range | Default | What it does |
|---|---|---|---|---|
| Wait mode | choice | fixed, random | fixed | One fixed delay, or a new random delay each execution |
| Duration | integer | 50–120000 ms | — | Required. The fixed delay, and the fallback if a random pair is incomplete |
| Duration min | integer | 50–120000 ms | — | Random mode lower bound |
| Duration max | integer | 50–120000 ms | — | Random mode upper bound |
| Reason | string | ≤ 500 chars | — | A note shown in the run log explaining why this pause exists |
Random mode
With waitMode: random, the runtime picks a fresh uniform integer delay in [min, max] per execution. A Wait inside a loop therefore pauses a different amount every iteration.
This matters for two reasons: it stops a flow from producing a perfectly regular timing signature, and it naturally spreads load when many instances run the same flow.
Duration stays required — it is the fixed value and the fallback if the random pair is ever incomplete.
Use the Reason field
Reason costs nothing and appears in the run log. "let the map settle after centring" tells you in six months why that 900 ms is there. Undocumented magic numbers are how flows rot.
Ports
| Port | Taken when | Required |
|---|---|---|
| Success | The full wait elapsed (output: milliseconds actually waited) | Yes |
| Cancelled | The run was stopped during the wait | No — never followed |
| Fatal | The duration is outside 50–120000 ms | No — never followed |
Wait has no Failure and no Timeout port. A wait cannot fail; it can only be cancelled or misconfigured.
Basic example
Let an opening animation finish:
- Duration:
1000ms - Reason:
"opening animation"
Realistic example — settle after a gesture
The randomised settle absorbs the variation between a fast machine and a slow one, and the following detection confirms the result rather than assuming it.
Advanced example — pacing a loop
Inside a loop that repeats an action many times, a fixed delay makes every iteration identical. A random one does not:
- Wait mode: random
- Duration min:
1000, max:1500 - Reason:
"human-like pacing between trips"
Best practices
- Replace Waits with detection wherever a condition exists. This is the single biggest speed win available in most flows.
- Randomise repeated waits. Fixed delays in a loop are both slower and more uniform than they need to be.
- Always fill in Reason.
- Prefer one deliberate Wait over several scattered ones. If you find three Waits in a row, the flow is guessing.
- Never use Wait to "make retry work". Configure backoff on the node's retry policy instead.
Performance notes
- A Wait costs exactly its duration, every single time. This is the key difference from a detection node, which returns as soon as its condition is met and only burns the full timeout in the worst case.
- Replacing a 2000 ms Wait with a
Find Imageon a 2000 ms timeout typically costs 200–400 ms in practice, because the image is usually there quickly. - Waits multiply inside loops. A 1500 ms wait in a 200-iteration loop is five minutes of doing nothing.
Memory notes
- Wait allocates nothing and holds no frame. Its footprint is zero.
- Because it sleeps in cancellable chunks, a long Wait does not hold any resource open.
Common mistakes
| Mistake | What happens | Fix |
|---|---|---|
| Fixed waits everywhere | Slow and still brittle — devices vary | Wait on a detection result |
| Too short for the animation | The next node reads a mid-transition frame | Raise it, or verify with detection |
| Using Wait instead of retry backoff | Retry has its own backoff | Configure backoffMs on the node |
| Duration below 50 ms | Fatal — outside the valid range | Minimum is 50 ms |
| Expecting a Failure port | There is none | Wait cannot fail |
Troubleshooting
The flow is slow but every node looks fine. Add up your Waits. Fixed delays are the usual cause of a flow taking minutes when it could take seconds.
The wait seems to be ignored. Check whether the node is on the executed path at all — an unwired branch never runs.
The node exits Fatal. The duration is outside 50–120000 ms. In random mode check that both bounds are in range.
Stopping the run takes a moment during a long wait. Expected — the sleep is chunked, so cancellation lands at the next chunk boundary rather than instantly.
FAQ
What is the longest wait? 120000 ms — about two minutes. For longer pauses, use the Scheduler.
Does a random wait re-roll each loop iteration? Yes, once per execution.
Can the duration come from a variable?
durationMs accepts a whole-string {{variable}} reference. The random bounds are plain integers.
Does the Wait count toward the run duration guardrail?
Yes. All wall-clock time counts toward maxRuntimeDurationMs.
Related nodes
- Find Image — wait for a condition instead of a time
- Check Region — wait for a colour or change
- Swipe / Zoom — the gestures that need settling
Related pages
- Retry and Failures — backoff versus waiting
- Execution Model — why total time is the sum of node times