1

I have problem with download in headless mode, when I try add chromeOptions.setHeadless(true); then driver cant download XLS, but in no headless mode all is fine, driver.get(http); navigate to automatic download - my code:

public void getXLS() throws InterruptedException {
    System.setProperty("webdriver.chrome.driver", "/usr/lib/chromium-browser/chromedriver");
    ChromeOptions chromeOptions = new ChromeOptions();
    // chromeOptions.addArguments("--no-sandbox");
    // chromeOptions.addArguments("--headless");
    // chromeOptions.addArguments("disable-gpu");
    // chromeOptions.addArguments("window-size=1400,2100");
    // DesiredCapabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
    WebDriver driver = new ChromeDriver(chromeOptions);
    // chromeOptions.setHeadless(true);
    driver.get("url");
    WebElement element = driver.findElement(By.name("_username"));
    element.sendKeys("mail");
    WebElement element1 = driver.findElement(By.name("_password"));
    element1.sendKeys("pass");
    element1.sendKeys(Keys.ENTER);
    driver.get(http);
    driver.quit();
}

0 Answers0