cancel
Showing results for 
Search instead for 
Did you mean: 

Download file in web application

RishabhChauhan
Level 3
Hi,

I am facing an issue while automating a web based application. We have to download a file but there is no notification or any activity once we click on Download file button. Sometimes it takes 1 min and sometimes 10 min. How to make it dynamic?

------------------------------
Rishabh Chauhan
------------------------------
4 REPLIES 4

ritansh.jatwani
Level 9
Hi @RishabhChauhan,

In order to deal with this scenario, you can create a logic to keep checking the "Downloads" folder (or any specific folder where you keep all the downloaded files)​ every 10 seconds if any new file came up or not. You can also keep a maximum counter of say 15 minutes. If after 15 min, still the file doesn't get downloaded, you can throw an exception.  Hope it helps !!

------------------------------
Ritansh Jatwani
Manager
Deloitte
Gurgaon
*If you find this post helpful mark it as best answer
------------------------------

Thanks Ritansh for the solution. But there will be various files already in the Downloads folder which are useful for the other processes.

------------------------------
Rishabh Chauhan
------------------------------

Hi R,

Indeed, but if you first open the Download folder, then start the download, the new file popping up there will be the download you are waiting for. The long waiting time is only to guard for large files that may take longer to download, or perhaps a slow network connection.

------------------------------
Happy coding!
---------------
Paul
Sweden
------------------------------
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)

Hi @RishabhChauhan

​I just wanted to add to the other comments on this one, if you use the Get Files VBO then you can sort this by earliest and check todays date against the files. If todays file exists then you will know it has finished downloading. If there are more than one file being downloaded today then check the timestamp against the current time using a calculation stage. You could even add a data time to set the time you started the download and then you can check if the latest files timestamp is greater the download start time.

You may also want to give a reasonable wait period before doing the check just to make sure its had a good amount of time to finish the download before you start checking for the file. This will help reduce the need to continually loop while looking for the file.

Hope this helps 🙂

------------------------------
Michael ONeil
Technical Lead developer
NTTData
Europe/London
------------------------------