Reputation: 23
Whenever I try to download a simple CSV file from a specific website the ChromeDriver downloads a blob.
I tried to resolve this with the following ChromeOptions but it did not help:
"download.default_directory": "c:/test_downloads/"
"download.prompt_for_download": False
"download.directory_upgrade": True
How can I download a file directly to my hard drive using ChromeDriver?
Upvotes: 0
Views: 1466
Reputation: 23
The following code snipped solved my issue:
from selenium.webdriver.chrome.options import Options
chromeOptions = Options()
chromeOptions.add_experimental_option("prefs", {
"download.default_directory": r"d:\Downloads",
"download.prompt_for_download": False,
"download.directory_upgrade": True,
"safebrowsing.enabled": True
})
webdriver = webdriver.Chrome(options=chromeOptions)
Upvotes: 1