WaitDownload Activity

Hey There,

I have to download a report from a website, but need to wait for 60 seconds for that report to generate.

  1. if it takes more than 60 seconds, need to exit out of the new chrome tab that got open while clicking on the run report button.
  2. But, if it takes less than 60 seconds, it should automatically get downloaded.

Can someone please help with this problem in UiPath?

1 Like

Hi @ayushi_jain3 ,

Use Wait for download activity with timeout 60 seconds. Use this in Try catch activity. In else attach new download window and use close tab activity.

3 Likes

Hi @ayushi_jain3

Use the Wait for Element Vanish activity or Element Exists activity with a timeout of 60 seconds to wait for the report to generate. If the report is generated within 60 seconds, you can move on to the next step. If not, you can use the Close Tab activity or Close Application activity to close the new Chrome tab that was opened during the report generation process.

Once the report is generated, you can use activities such as Click or Type Into to download the report. If the download is triggered automatically, you can wait for the download to complete using the Wait for Download Complete activity.

Thanks!!

Hi @Nitya1 - This is not working as I have a button of “run report” in the website , which on getting clicked opens a new tab and the report gets downloaded in background. My query is to check if the download is happening in 60mseconds or not. If it does, then I don’t need to do anything on that new opened tab, but if it takes more than 60 seconds to download, I need to cancel that downloading and exit out of the newly openend tab and [perform actions on the original website.

Hope this is clear? If any lead for this one please let me know . Highly appreciated. Thanks ! :slight_smile:

Hi

Hope the below steps would help you resolve this

Use a assign activity like this

arr_filepath = Directory.GetFiles(“folder path where ur downloaded file gets saved”)
Where arr_files is a variable of type array of string

After this use a assign activity and get the count of files from that download folder

int_filecount = arr_filepath.Count

Where int_filecount is a variable of type int32

  1. Now after clicking on the button with click activity the new tab opens

  2. Then Use a assign activity and mention like this

counter = 0

Where counter is a variable of type int32

  1. Now use a WHILE loop and inside the loop use the same assign activity like this

arr_files = Directory.GetFiles(“folder path where ur downloaded file gets saved”)
This is understand where any new file is downloaded or not

Then inside the loop use a
IF condition like this

counter < 60 AND arr_files.Count < int_filecount

If true it will go to then block where use a assign activity to increment the counter

counter = counter + 1

If false then it goes to else block where use a CLOSE TAB activity

Cheees @ayushi_jain3