VBobCat VBobCat - 3 years ago 409
Vb.net Question

How to detect when all downloads finished with Selenium Webdriver and Firefox

I have an instance of FirefoxDriver that performs several operations and starts downloading several files. Those files may have various sizes and when it finishes the loop and shuts down it interrupts unfinished downloads. Is there a way I can check whether there are pending downloads and then wait until they are all complete before closing Firefox Window? This is for VB.NET but I can understand C# solutions too. Thanks!

Answer Source

Firefox and Chrome when downloads a file creates and intermediate file extensions. For chrome it's crdownload, I don't remember what it's for Firefox. However, you can download a large file and check. Once download is completed this intermediate file is renamed to actual file name.

All you need to do it write a code which check if any file with crdownload extension is exist or not. if not, your download is completed.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download