selenium tests fail against headless chrome selenium tests fail against headless chrome google-chrome google-chrome

selenium tests fail against headless chrome


This is what worked for me:

var chromeOptions = new ChromeOptions();                        chromeOptions.AddArguments("--headless");chromeOptions.AddArguments("--disable-gpu");chromeOptions.AddArguments("--window-size=1280,800");chromeOptions.AddArguments("--allow-insecure-localhost");//specifically this line here :)chromeOptions.AddAdditionalCapability("acceptInsecureCerts", true, true);

Found from https://bugs.chromium.org/p/chromium/issues/detail?id=721739


I had the same issue, the local server was using selfsigned certificate, here is the combination that worked for me:

ChromeOptions options = new ChromeOptions();options.addArguments("--headless");options.addArguments("--disable-gpu");options.addArguments("--no-sandbox");options.addArguments("--allow-insecure-localhost");


Try this:

final ChromeOptions options = new ChromeOptions();options.addArguments("--headless");options.addArguments("--window-size=1280,800");WebDriver driver = new ChromeDriver(options);