I am trying to save an image by using save as option inside a specific folder. I found a way by which I am able to right click on the image which I want to save using save a
For Chrome Browser:
Even you can disable the windows dialogue (Save As Dialogue) with the following code snippet. You need to do following settins in the chromedriver preferences:
Accept any certificate in browser
String downloadFilepath = "/path/to/download/directory/";
Map<String, Object> preferences = new Hashtable<String, Object>();
preferences.put("profile.default_content_settings.popups", 0);
preferences.put("download.prompt_for_download", "false");
preferences.put("download.default_directory", downloadFilepath);
// disable flash and the PDF viewer
preferences.put("plugins.plugins_disabled", new String[]{
"Adobe Flash Player", "Chrome PDF Viewer"});
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", preferences);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(capabilities);