How to confirm that a file is completely downloaded

I am using ui path to download a file from a website and for my next activity I need to wait till it downloads ,so is there any way to know if it is completely downloaded.

1 Like

Hi,

May not be right solution but working fine though :wink:
Thought of many workaround but not 100% efficient.
How about keeping an eye on progress bar :stuck_out_tongue:

  • Go to download (ctl+j)
  • check whether download started or not (image exist on progress bar)
  • once started then look for progress bar to vanish (Wait Image Vanish)

Browser: Chrome

thanks for the reply @ddpadil , but in my case the download size is very big and it’s taking a lot of time to download so if i use this flow I will have to make sure that download window is open and wait till the download gets completed.
but i am looking for a solution that will monitor in background and notify me if it gets completed.
so that meanwhile I can do other activities.
Is it possible??

oh :frowning:
thought of another approach:

  • Get the new file which is downloaded
  • Try to open it eventually its gives error if its still in progress else the file will be processed this is how you can validate the confirmation of file download.
  • But here is a catch what if you next activity(entire post workflow) get over before i check the file status of the downloading file(as you mentioned it take a lot of time to download).
    Are you using monitor event (user assistance agents) i guess it doesn’t make any sense as you wants to know status background.

@ovi @aksh1yadav any ideas :thinking:

@ddpadil
actually I think for this also I need to open the file location all the time so that i can loop over that file opening activity as let say in every 5 min it will try to open the file and continue the loop if error comes …
but as i said download can take a lot of time and i want to do other activities simultaniously .
I dont want to just look at one window until download gets completed.
and I am not using any monitor event activity instead i was using while loop to check the image exist as ur first reply.
will that monitor event activity help in my case?

Is your file having the same name as filename while download is in progress? If not, you could keep checking for file exists (if you know the file name) in that folder, once found go to your next activity.

2 Likes

I was thinking the same because when your file is being downloaded, at least in Firefox, the file name is something like filename.part. It basically changes the extension and once it completes the download, it changes to the original file extension.

2 Likes

If not by filename you can go by file size. When the file isn’t downloaded yet, it usually is 0kb.

1 Like

I don’t think so. :stuck_out_tongue:
When file is being downloaded then its file size keep on changing.
Checking file extension would be reliable solution .

2 Likes

ya , actually I am able to do it by checking the .part extention
thanks to all for your valuable reply:grinning::grinning:

1 Like

@kamal,

Hi kamal , you have to use do while loop for check element exists . If you are using IE browser
Its will be popup once download is completed . You have to check continuously till the element exists. Once the element exists the loop will be stopped. Thanks

1 Like

Hey @kamal!

Do you know the name of the file you are downloading?

If you do, go with File.exists. Wrap it in a loop and wait for the file to be downloaded. It works like a charm.

Be careful not set up an infinite loop that might stop your automation. You need to consider if something can go wrong during download.

This is much better than using image/element exists/vanish.

Best Regards,
Bernardo

3 Likes

While in the loop, define a Timespan. If the the Timespan is exceded throw an exception.

Quick question as I found this while searching the same issue, what if the file name changes each time? Can you use a wildcard at the end of the file path, for example the file I am using is date time stamped, so the prefix will always be the same but followed by the date time stamp. Then would my next step be to use a double click inside an excel application scope, again how do I manage the file name changing? Thoughts?

Hi @Heather_Sims, did you end up finding a solution for this? I have also ran into the same issue - but realised I can’t use wildcards in the file path. If you had found a solution, please share :slight_smile:

Hey, let me share with you the flow that I use to confirm the download for big files with IE…SaveAsDownloadGUI.xaml (68.0 KB)

Hi @VB_THA - thanks for the example - but in your example you used IE and getting the download completed notification, However, I have to use chrome and check whether the fileextension changed from “.crdownload” to something else. I wish to use loop and file exists activity to check whether any file with extension “.crdownload” exists. If not, then conclude that the download is complete. In my case, I don’t know what the file name would be - so I have to check whether any file exists with the extension. That’s the part I am struggling to find a solution. Please help if you can

Hi bokapakhi,

Hummmm, I see. The idea that I have is related with the notifications, try to enable the download notification on Chrome Settings > Advanced >Download (asking where to save each file before downloading)
and then you could do something with an element exists and a while to check if the notification is already been shown creating a loop.

If we are using latest community version then there is an activity (Wait for Download) that we can make use of.

1 Like

Could you please explain more on this, how to give a name?