I am doing an automation E2E and trying to download files for a Drop-down working perfectly using chromedriver not headless mode , but when giving chrome options as headless the file is not downloaded .
The Drop-down when you click on the file it opens an external link and then downloads the file and go back again to the main screen , i have to open the file and check the data inside it , but unfortunately it's not download
and this is the code of my Webdriver manager
String downloadFolder = System.getProperty("user.dir") + "/exportedFiles";
HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
chromePrefs.put("plugins.always_open_pdf_externally", true);
chromePrefs.put("download.default_directory", downloadFolder);
chromePrefs.put("browser.setDownloadBehavior", "allow");
chromePrefs.put("download.prompt_for_download", "false");
ChromeOptions options = new ChromeOptions();
options.addArguments("headless");
options.addArguments("--test-type");
options.addArguments("--disable-extensions");
options.setExperimentalOption("prefs", chromePrefs);
driver = new ChromeDriver(options);
Aucun commentaire:
Enregistrer un commentaire