Unable to download file using ChromeDriver
<p>I am using chromedriver with selenium to download files from application. But while clicking on download button in application, it given error as "<code>Failed-Download error.</code>"</p>

<blockquote>
  <p>Chromedriver version : 2.21
  Selenium version : 2.53.0</p>
</blockquote>

<p>Code for initializing chrome driver and changing download location :</p>

<pre><code>            String newPath = "D:\\Backup" + File.separator + "Database ";
            new File(newPath).mkdir();
            HashMap&lt;String, Object&gt; chromePrefs = new HashMap&lt;String, Object&gt;();
            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();
</code></pre>

<p><strong>Error is</strong> :</p>

<p><a href="https://i.stack.imgur.com/thNbL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/thNbL.png" alt="enter image description here"></a></p>

<p>Can someone help me with this?
I am able to download file from Chrome manually.</p>