I am automating the web application to run in Headless Chrome. ChromeDriver Version:- ChromeDriver 74.0.3729.6 Application Login screen has windows popup to enter username and password. I used alerts to handle the popup in normal chrome
WebDriverWait wait = new WebDriverWait(driver, 18);
wait.until(ExpectedConditions.alertIsPresent());
Alert alert = driver.switchTo().alert();
alert.sendKeys("username" + Keys.TAB + "password");
alert.accept();
When Chrome is set to headless, windows popup is not displaying. I could only see blank screen in screenshots.
Also, i tried adding the chromeoptions as
String path = "path to chromedriver";
System.setProperty("webdriver.chrome.driver", path);
System.setProperty("webdriver.chrome.logfile", "./chromedriver.log");
System.setProperty("webdriver.chrome.verboseLogging", "true");
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
options.addArguments("--disable-gpu");
options.addArguments("--disable-popup-blocking");
driver = new ChromeDriver(options);
ChromeDriverLog has the default values as
"default_content_settings": {
"geolocation": 1,
"mouselock": 1,
"notifications": 1,
"popups": 1,
"ppapi-broker": 1
}

