I’m trying to automate a process where I log into a website, download a series of documents, process them, then re-upload. I’m having trouble downloading; the preferences don’t seem to work:
chromedriver_path = "C:\\Users\\XXX\\PycharmProjects\\YYY\\util_files\\chromedriver-win64\\chromedriver.exe"
service = Service(chromedriver_path)
options = Options()
options.headless = True
options.add_argument("--incognito")
prefs = {"download.default_directory": "C:\\Users\\XXX\\Downloads",
"download.prompt_for_download": False,
"download.directory_upgrade": True}
options.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome(service=service, options=options)
It doesn’t run it headless (not a big deal) but it keeps prompting me with the download dialog. It’s tough to find a solution online because it seems like Selenium has updated how it does some things over time, so I don’t know of my code is the most up to date or not. TIA
You must log in or register to comment.
Solved it myself; the preferences don’t work with incognito mode. -_-