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.