I am using chromedriver with selenium to download files from application. But while clicking on download button in application, it given error as "Failed-Download error.
"
Chromedriver version : 2.21 Selenium version : 2.53.0
Code for initializing chrome driver and changing download location :
String newPath = "D:\\Backup" + File.separator + "Database ";
new File(newPath).mkdir();
HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
chromePrefs.put("profile.default_content_settings.popups", 0);
chromePrefs.put("download.default_directory", newPath);
chromePrefs.put("safebrowsing.enabled", "true");
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", chromePrefs);
options.addArguments("--test-type");
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
cap.setCapability("disable-popup-blocking", true);
cap.setCapability(ChromeOptions.CAPABILITY, options);
System.setProperty("webdriver.chrome.driver", CHROME_DRIVER_PATH);
driver = new ChromeDriver(cap);
// Maximize the driver window
driver.manage().window().maximize();
Error is :
Can someone help me with this? I am able to download file from Chrome manually.
In my case I had something similar, but the error was in the folder name I used. I describe the path as C:/myFolder instead of C:\myFolder.
In previous version of ChromeDriver the first approach was still valid. Now it looks like this is not working anymore giving some Download error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With