[UiPath] Wait For Download activity - download files easily

Quite often, we need to download and store some files from websites. Reports, invoices, anything.

Quite recently, UiPath introduced a very handy activity - Wait for Download.

If you ever tried to automate downloading files, you know how tricky it can be. Browsers show some popups, then often there is a problem with the Save As popup. And you had to also check for a prompt, if that file already exists. What a work…

Thankfully, these all many activities including clicks, and types, and conditions can be now replaced with one neat activity.

The prerequisite is to set up your browser to automatically download files (to avoid the extra prompt window).
See this example:

obrazek
The “Do” part is initially empty. Drag inside an activity, that will cause the download to start.
Monitored folder is your default Downloads folder. Changing the path will not change where the file will be downloaded. It only says to the robot - take a look at this folder, expect a new file here.
UPDATE: You can use "C:\Users\"+system.Environment.UserName+"\Downloads" to use this code with any user at any machine! :slight_smile:
Downloaded file as a datatype FileInfo is Output variable from this activity. We can use this variable to address the file, to perform next operation such as Copy or Move the file to another folder.

Like this: :sun_with_face:
obrazek
(we have to use downloaded_file.FullName, because activites such as Move File accept path to file as String)

Easy, right? :slight_smile:

After the download is done, UiPath proceeds to the next activity.

Use this activity for your automation and let me know, if this article helped you! :slight_smile:
Do you have some issues, ideas - please ask!


1 Like

What? I didn’t know this exist :no_mouth: so helpful!

1 Like

Update! If you struggle with your Wait For Download activity not working at all - not executing the part that should initiate the downloading, it is because of a described bug. You might be cleaning out your workflows from unnecessary sequences and containers and suddenly - your good intentions will lead to break your process.

image

Source: Wait For Download does not execute "Activity to initiate download" block - #7 by SpencerAF - Activities - UiPath Community Forum

1 Like

One more update:
If you struggle with this activity not working properly and the issue is that you get error complaining about .tmp file or your activity is registering the .tmp file before the file gets its name.

Solution is to upgrade to UIPath.System.Activities preview release 21.12.0 or higher.

This will add new Property:
image

If you want to solve your issue, type in:

"tmp"

Enjoy! Roman, the guy that picks all you need for you to know about UiPath.
:heart:
Source: Download file activity picking .tmp file issue - #43 by Christopher_Stock - Activities - UiPath Community Forum

image
Hi there! I am trying to download the file from chrome which will directly save to “C:\Users\Downloads” and move the downloaded file to another newly created file, but the error shown: Tmall.xaml: Compiler error(s) encountered processing expression “downloadedfile.FullName”.(2) : error BC30512: Option Strict On disallows implicit conversions from ‘String’ to ‘IResource’.

Any suggestions to solve this error? T.T Many thanks!!

Hi and welcome to Robot ICT Community Forum!

Thank you for your question. Hmm, I was trying to replicate the same behaviour on my side, however without success. It seems like you are using maybe a beta versions or early releases of packages?
Can you share what versions of packages do you use?
You can find it in project.json or in Studio - Manage Packages.
What is version of your Studio?

Thanks, it may be a bug in early release. You can try go back to stable release.

Hi, long time since this thread but I can’t get this to work. The folder where Edge saves downloaded files are temp folders with dynamic names so I can’t get the folder name. Noone seem to have this problem so I guess I’m doing something wrong?!

Solved: Unabled the Edge function for Asking what to do with a downloaded file.