Identifying if the file is downloaded

Hey People,

So I am saving a WebPage from IE using ‘Ctrl+P’
I follow these steps:

  • On the WebPage Send HotKey ‘Ctrl+P’
    Print Dialog Box Appears
  • Double Click on ‘Microsoft Print to PDF’
    File Save Dialog Box Appears
  • Use Type Into to type the Save Location and Enter.
    And the File gets downloaded.

Now my Query is, How will the Bot Identify whether the Download or saving is completed.
Because in this scenario there is no Update on the screen visible to identify it.

Check with path exists and make the path exists property to file.

2 Likes

It exists,

I mean, when I try this it is present but still in use.
Like if the file is of 1000Kb.
In the start it will be 10kb and then 20kb and so on. So the Path exists but in use.
It depends on Machine and Network Speed.

It will be perfect if I can find if the file is idol and then perform other steps on it.

Hello @chandu4712, Make sure the Filename of the Downloading and Downloaded(including extension).

Because when we Download a file from IE, the File Extension is vary. We can use Do while until the original filename was Exists.

TanQ,
Michael Udhaya

Hey @Michael_Udhaya,

The Filename is different when you download a file from IE.
In my case I am saving file using print dialog box ‘Ctrl+P’
The File name is abc.pdf from start till end until it gets downloaded.

Similarly like you copy a file from Folder A to Folder B, the name is same but the size increases as the File gets copied.

if the file downloaded is usually of a fixed size add a certain delay before checking, also assume a worst case for the network speed.

for checking, you can check for the file name in the saved directory if it exists

1 Like

Hi @chandu4712,

There are multiple ways to do that.

  1. You can use C# code to check the latest file in the directory and extract the extension of the file. If it matches with the key then it will work for you.
  2. You can use delay based on your analysis like in how much time it will take to complete and execute step 1.
  3. You can use download pop-up of IE and use element exist activity to look for Completed/Finish button.

Best!
Anmol

2 Likes

@johnny123

The filesize is not Same in all the cases. It varies.

But I have implemented something which is on similar lines:
Upon analyzing I understood that, While the file gets downloaded in the Background it changes from 0kb to directly Whatever the size is.
So after download click -> I am checking if the file size -> if zero -> check again -> If not - > the download is Completed.

I hope this helps someone going forward.

1 Like

Hey @anmolk171

  1. The extension of the file remains same during the download process. So can’t decide whether the file is downloaded or not. Doesn’t help
  2. I keep delay as the last option in my workflow since this sometimes adds latency when not needed.
  3. If you look on the previous replies to this post, I am not able to see any pop up or download window to identify the download process.

Anyways, Thanks for your time and suggestions.

Cheers to others too who helped on this, @Divyashreem, @Michael_Udhaya and @johnny123 :beers:

1 Like

yes your approach is better

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.