我有一个使用java selenium-webdriver,chromedriver创建的自动化过程,并使用eclipse . 关键是通过无头和禁用gpu进行处理我得到的是下载是正确的但它没有出现在目录中,而是如果无头选项和gpu它出现在目录中 . 附上下面的代码,如果有人知道如何做,可以帮助我,我将不胜感激,谢谢 .

// ********* PARA CHROME ******* System.setProperty(“webdriver.chrome.driver”,“C:\ Users \ Dani \ Desktop \ driver \ chromedriver235 \ chromedriver.exe “); // localiz版本2.35 chromedriver

String downloadFilepath = "C:\\Users\\Dani\\Desktop\\FACTURAS";
HashMap<String, Object> prefs = new HashMap<String, Object>();
        prefs.put("profile.default_content_settings.popups", 0);//ventanas emergentes
        prefs.put("download.prompt_for_download", false);
        prefs.put("download.default_directory", downloadFilepath);//directorio para descargas local
        prefs.put("download.prompt_for_download", false);
        prefs.put("download.directory_upgrade", true);
        prefs.put("profile.default_content_setting_values.automatic_downloads", 1);
ChromeOptions options = new ChromeOptions();
HashMap<String, Object> chromeOptionsMap = new HashMap<String, Object>();
        options.addArguments("--headless");
        options.addArguments("--window-size=1920,1200");//necesario para el headless (tamaño pantalla)
        options.addArguments("--disable-gpu");
        options.addArguments("--no-sandbox");
        options.addArguments("--disable-popup-blocking");
        options.addArguments("--disable-notifications");//desactivar notificaciones
        options.addArguments("--disable-infobars");//evitar que apareguin infobars
        options.setExperimentalOption("prefs", prefs);
DesiredCapabilities cap = new DesiredCapabilities();
        cap.setCapability(ChromeOptions.CAPABILITY, chromeOptionsMap);
        cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);// Bydefault it will accepts all popups.
        cap.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(options);
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);//indicamos segundos entre acciones