Selenium-Python , find out when a download has completed

0 votes
I've used selenium to initiate a download. After the download is complete, certain actions need to be taken, is there any simple method to find out when a download is complete?

I am using the Firefox driver.
Sep 4, 2018 in Selenium by Martin
• 4,220 points
283 views

1 answer to this question.

0 votes

There is no built-in to selenium way to wait for the download to be completed.

The general idea here would be to wait until a file would appear in your "Downloads" directory.

This might either be achieved by looping over and over again checking for file existence:

Check and wait until a file exists to read it:       

import os.path
import time

while not os.path.exists(file_path):
    time.sleep(1)

if os.path.isfile(file_path):
    # read file
else:
    raise ValueError("%s isn't a file!" % file_path)
answered Sep 4, 2018 by Meci Matt
• 9,420 points

Related Questions In Selenium

+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,070 points
437 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
788 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
431 views
0 votes
1 answer
0 votes
1 answer