0

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?

Download list of chrome

taught
  • 23
  • 6
  • I think you should refer to [this](https://stackoverflow.com/questions/46937319/how-to-use-chrome-webdriver-in-selenium-to-download-files-in-python) question for a better idea. – Arun Ramachandran Jan 23 '20 at 11:04
  • 1
    I saw that post and used the options from it without success. After I copy-pasted the entire code it works now. I think I messed up the syntax. – taught Jan 23 '20 at 11:19
  • 1
    That's great. Would you mind to add the solution with the proper set of code? This may help someone else in the future. – Arun Ramachandran Jan 23 '20 at 11:26

1 Answers1

1

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)
taught
  • 23
  • 6