![]() ![]() ![]() def downloads_done():įor filename in os.listdir("/downloads"): This only works for chrome and chromium i think. crdownload extension in the download folder then all your downloads are completed. I have had the same problem and found a solution. Is it possible to determine download completion in webdriver? I want to avoid using time.sleep(x). Print('Timeout in thread number: ' + str(num) + ', retrying.') ![]() My code: def file_download(num, drivervar):ĭownload_button = WebDriverWait(drivervar, 20).until(EC.element_to_be_clickable((By.ID, 'download button ID'))) I had to use a static wait in order to wait for the download to be completed (ugly) I cannot check the file system in order to verify when the download is completed since i'm using multi threading (downloading lot's of files from different pages at once) and also the the name of the files is generated dynamically in the website itself. My code works, but the solution is far from ideal: the function below clicks on the website button that initiating a java script function that generating a PDF file and then downloading it. I'm using selenium and python via chromewebdriver (windows) in order to automate a task of downloading large amount of files from different pages. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |