I have a function to access a website and export some Excel file. For that, I import from selenium:
from selenium.webdriver.support.ui import WebDriverWait
<
The problem: downloads.Manager.get() doesn't work after version 80 of Chrome.
So, I chang# method to get the downloaded file name
def every_downloads_chrome(driver):
if not driver.current_url.startswith("chrome://downloads"):
driver.execute_script("window.open('');")
driver.switch_to.window(driver.window_handles[1])
driver.get("chrome://downloads/")
return driver.execute_script("""
var elements = document
.querySelector('downloads-manager')
.shadowRoot.querySelector('#downloadsList').items;
if (elements.every(e => e.state === "COMPLETE"))
return elements.map(elements =>elements.fileUrl || elements.file_url);
""")