How to exit Wait for Download?

Hey guys im currently running a process which clicks on a link which triggers a download. But sometimes it prompts an error message which says document isnt available. In that case can I add an if condition there which checks for the error message and use the break activity to exit the wait for download?

Have you tried it, to see if Break will exit the Wait for Download? Just try it. Then you’ll know if it works without waiting for someone here to try it for you.

Break might not work with wait for download

Instead what you can do is to use parallel activity…one with wait for download and other with check app state and if codnition…to check for file not exists…and in parallel ypu can give a condition which accepts boolean…so create a variable and set it to true in the if condition and also after wait for download …so tht if any of the one is executed the bot moves forward



Yes, you can use an if condition to check for the error message and then decide whether to continue with the process or exit the download phase.

Here’s a simplified example of what your workflow might look like:

├── If (Condition: Element Exists indicating error message)
│   ├── Log Message: "Error: Document isn't available"
│   ├── Take Screenshot
│   └── Break
└── Else
    ├── Click Link to Trigger Download
    ├── Wait for Download to Complete
    └── Continue with the rest of the process

Alternatively, you may follow @Anil_G logic.

Vinit Mhatre

yeah i did try using break and it didnt work.

Yes, you can add an if condition to check for the error message during the download process. If the error message appears, use the break activity to exit the download process and handle the error accordingly.

You can’t use Break inside the Wait for Download.

Here’s how to do it. A Throw will exit the Wait for Download. The Click initiates the download, the Check App State looks for the error popup and does a Throw if it’s found. The Try Catch handles if the Throw is executed. Otherwise the Wait for Download continues to wait.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.