0

I am using the following for setting up downloads directory.

chromeOptions = Options()
prefs = {"download.default_directory" : "F:/downloadedfiles"}
chromeOptions.add_experimental_option("prefs", prefs)
#chromeOptions.add_argument("download.default_directory=F:/downloadedfiles")

driver = webdriver.Chrome(executable_path=r"servers\chromedriver.exe", options=chromeOptions)

But when I run the program, it is still downloading in "C:\Downloads" directory.

Luuklag
  • 3,897
  • 11
  • 38
  • 57
Subbu
  • 217
  • 2
  • 11

1 Answers1

0

Try This:

ChromeOptions chromeOptions = new ChromeOptions();
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("download.default_directory", "F:/downloadedfiles");

(OR)

ChromeOptions chromeOptions = webdriver.ChromeOptions()
prefs = {"download.default_directory" : "F:/downloadedfiles"}

Set Chrome Options and Driver

chromeOptions.setExperimentalOption("prefs", prefs);
chromedriver = "path/to/chromedriver.exe"
driver = webdriver.Chrome(executable_path=chromedriver, options=chromeOptions)

Reference : https://sites.google.com/a/chromium.org/chromedriver/capabilities

Nayan
  • 471
  • 2
  • 9