Need help for "download.default_directory" is working on windows but not working on Linux
I am using Selenium, Java and chrome to automate the website. It has one test case wherein it automatically downloads one file. I have tried below code on windows, it worked fine but when try to execute it through Jenkins job which is having Linux operating system, it has failed to download the file in given path.
ChromeOptions options = new ChromeOptions();
HashMap<String, Object> prefs = new HashMap<String, Object>();
prefs.put("download.prompt_for_download", false);
prefs.put("profile.default_content_settings.popups", 0);
prefs.put("profile.content_settings.exceptions.automatic_downloads.*.setting", 1 );
String downloadFilepath = System.getProperty("user.dir") + "\\src\\test\\resources\\downloads";
if (System.getProperty("user.dir").startsWith("/home")) {
downloadFilepath = downloadFilepath.replace("\\", "/");
}
prefs.put("download.default_directory", downloadFilepath);
options.setExperimentalOption("prefs", prefs);
options.addArguments("start-maximized");
options.addArguments("--safebrowsing-disable-download-protection");
options.addArguments("safebrowsing-disable-extension-blacklist");
options.addArguments("--test-type");
options.addArguments("--disable-extentions");
options.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
WebDriver driver = new ChromeDriver(options);
The expectation is to download the file in the given path on Linux machine. But it is not downloading.