I'm trying to download a file with Selenium Chromedriver through Electron. As we could not handle the popup window with selecting folder to download in, I tried to avoid this popup in this way:
prefs.put("download.prompt_for_download", false);
But it doesn't work. The full code is:
ChromeOptions options = new ChromeOptions();
HashMap<String, Object> prefs = new HashMap<>();
prefs.put("profile.default_content_settings.popups", 0);
prefs.put("download.default_directory", LocationUtil.getDownloadFolderPath());
prefs.put("download.prompt_for_download", false);
prefs.put("safebrowsing.enabled", false); // to disable security check eg. Keep or cancel button
options.setExperimentalOption("prefs", prefs);
ChromeDriver chromeDriver= new ChromeDriver(options);
Also tried to put these prefs through Capabilities but with no success.
((MutableCapabilities) chromeDriver.getCapabilities()).setCapability(ChromeOptions.CAPABILITY, options);
Versions are:
- ChromeDriver 80.0.3987.16
- Selenium Java 3.141.59
How could I download the file in a specific directory without popup window in an Electron app? UPD: Tested with browser Chrome - all things are fine.