Using Selenium Java in my automation framework and trying to download PDF from Chrome, below is my code:
System.setProperty("webdriver.chrome.driver", "resources/drivers/chromedriver.exe");
ChromeOptions options = new ChromeOptions();
HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
chromePrefs.put("profile.default_content_settings.popups", 0);
chromePrefs.put("plugins.always_open_pdf_externally", true);
chromePrefs.put("download.default_directory", "C:");
options.setExperimentalOption("prefs", chromePrefs);
driver = new ChromeDriver(options);
I specified location "C:" (for just testing purpose) but the issue is that it downloads PDFs in Downloads folder.
Also is there a way to specify name of file that I'm trying to download?