Wait download finish

Hi guys,

I saw many issues related to my question but I didn’t find a solution.
I would like to know the best technique to wait for the browser to finish the download and proceed to the next activity in a dynamic way.
I’m using Mozilla and I know the name of the file and folder where it will be located.

I tried to use “Path Exists” but by the time the download starts, a file with the same name appears.
I tried to use the file size with the while loop, but the condition is lost when there is no file in the folder and nothing happens.

Suggestions?

Mozilla Firefox also creates a .part file. Check for the file as you’re doing now, but also check that the .part file is not in the same directory.

1 Like

@Anthony_Humphries the problem is not the .part file, but mozilla replicates an identical file to the one to be downloaded

Yes, but to be certain the download is complete, the condition must be that test.csv exists and at the same time that test.csv.part does not exist.

@Guilas, i think @Anthony_Humphries is right, you can have a while loop checking, like while test.csv.part exists keep iterating, once it no longer exists you stop and move on to the next activity, however you need to have at least a 2 second delay before you check because it might check while the download has not started and obviously the file would not exists then it meets the condition, not sure if i make sense at all.

@Guilas, Here is another thought, if you are downloading documents or images, set Firefox to open the file when finished downloading, and then loop around to check if (for example if you are downloading images, check if your default images viewer selector exists and if it does kill it or close it) and if it doesn’t, loop around again and increment counter, you can set it up in a way that if your counter gets to 50 and element still doesn’t exist it gets out of the loop just to avoid infinite loop in case the download failed.

@SenzoD @Anthony_Humphries
I tried this, but nothing happens

ArquivoPart = “C:\Users\Documents\UiPath\projectq\Arquivo\Filename_”+datetime.Now.ToString(“ddMMyyyy”)+“.csv.part”

I have created a custom workflow “WaitForDownloadToComplete” for my use.
You can call it after download is initiated and it waits till file is downloaded.

It accepts an IN argument only i.e “FileFullPath”.
You have to pass full path of file for example “C:\Users\User\Documents\UiPath\IsFileDownloaded\20MB.zip”

and it waits till file is downloaded fully.

Please refer to attached workflow XAML fileWaitForDownloadToComplete.xaml (8.5 KB)

Update: The discussion contains solutions that are no longer correct.
The modern UiPath Wait for Download activity will now handle this:
https://docs.uipath.com/activities/docs/get-last-downloaded-file