Hi, The following questions and the fix is a work around to download the file to a custom folder in with chrome driver/browser with 114 version
- Are you getting asked to Save the file while trying to download in Incognito mode?
- Does the file download to "Downloads" folder by default in non incognito mode ?
- Are you seeing in consistent behavior to download a file using ChromeDriver 114 ?
The work around fix worked for me is to keep the browser in headless mode with --headless=old so the file will download to custom path specified.
final static String downloadPath = "C\\Automation\\downloads; HashMap<String, Object> chromePrefs = new HashMap<>(); chromePrefs.put("download.default_directory", downloadPath); System.out.println(chromePrefs.get("download.default_directory")); ChromeOptions options = new ChromeOptions(); options.setExperimentalOption("prefs", chromePrefs); options.addArguments("--headless=old");
driver.set(new ChromeDriver(options));
References:
No comments:
Post a Comment