You can use your browser's download manager to check the states of downloads. For firefox this would look like this:
#firefox-specific
def wait_for_downloads_completed(driver):
original_window = driver.current_window_handle
driver.switch_to.new_window('tab')
driver.get("about:downloads")
while True:
items = driver.find_elements(By.TAG_NAME,"richlistitem")
#state 0=downloading, 1=done, 4=paused, 3=cancelled
if all(item.get_attribute("state") == "1" for item in items):
break
time.sleep(2)
driver.close()
driver.switch_to.window(original_window)
You can use browsers download manager to check the states of downloads. For firefox this would look like this:
#firefox-specific
def wait_for_downloads_completed(driver):
original_window = driver.current_window_handle
driver.switch_to.new_window('tab')
driver.get("about:downloads")
while True:
items = driver.find_elements(By.TAG_NAME,"richlistitem")
#state 0=downloading, 1=done, 4=paused, 3=cancelled
if all(item.get_attribute("state") == "1" for item in items):
break
time.sleep(2)
driver.close()
driver.switch_to.window(original_window)