I have a program that downloads a file using selenium and then gets the file name with os.listdir
.
My problem right now is that the download takes too long, and my code has moved on with the process. How can I pause the code until the file is downloaded?
Is there a selenium wait until download complete, or a way for selenium to pass the downloaded files name into a variable that i can plug into the answer from here
driver.find_element(By.XPATH, '//button[text()="Export to CSV"]').click()
wait.until(EC.element_to_be_clickable((By.XPATH, '//button[text()="Download"]')))
driver.find_element(By.XPATH, '//button[text()="Download"]').click()
files=os.listdir(folderPath)#finds all files in folder
print(files)