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.
Any idea what I am doing wrong here.
Thank you.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.