Help Centre › Building Processes
A gateway lets the bot try several branches and carry on down the first one that works. A junction merges several paths back into one. Both are added from the Add step tab on the process map.
1. What a gateway does
Use a gateway when the next step depends on what is on the screen, and you can't test for it with a simple condition. For example, after signing in a website may show the dashboard, a "change your password" page, or a cookie banner.
When the run reaches a gateway, the bot:
- Takes the first branch and runs the first step of that branch.
- If that step works, the run carries on from that step, down that branch.
- If it fails, the bot tries the first step of the next branch, and so on.
- If every branch fails, the gateway fails with "All gateway branches failed". An EXCEPTION connection from the gateway catches this.
Each branch's first step gets a short time to work: the wait set on the connection into it, or 3 seconds if none is set. Keep that first step a quick check, such as "Check if element exists" or "Check if window exists", so a wrong branch fails fast.
Add a gateway
- On the process map, open the Add step tab and drag Gateway onto the canvas.
- Give it a name, for example "Which page opened?", and click Add.
- Draw a connection from the gateway to the first step of each branch. You need at least two. Every branch connection must be DEFAULT; a gateway can't have a FALSE connection. If the map makes a new connection EXCEPTION (red), click it and change it to DEFAULT.
- Optionally add one EXCEPTION connection for when no branch works.
2. Junctions: merge paths into one
A junction is a pass-through point. Several connections go in and one comes out. It makes no choice; whichever path arrives, the run carries on out the other side.
Junctions keep a map readable. Without one, several steps that all lead to the same next step give you a tangle of crossing lines.
- Open the Add step tab and drag Junction onto the canvas.
- Connect the incoming paths to it, and draw one connection from it to the next step.
3. Which one to use
| You want to | Use |
|---|---|
| Go one of two ways, based on a condition | Decision |
| Go one of many ways, based on a value | Switch |
| Try several ways and keep the first that works | Gateway |
| Bring several paths back together | Junction |