3

Under SpecFlow/Selenium, I'm starting Chrome like this:

    var options = new ChromeOptions();
    options.AddArguments("--headless", "--window-size=1920,1080", "--disable-gpu", "--disable-extensions", "--no-sandbox", "-incognito");

    var svc = ChromeDriverService.CreateDefaultService();
    svc.Start();

    Context.Driver = new ChromeDriver(svc, options);

As the -incognito flag on the Chrome executable starts the browser in incognito mode I was thinking this was do the same for headless mode. I was wrong. Can it be done with headless? If so, how?

I have also tried --incognito and incognito as well as placing the flag at different indices within the AddArguments() call.

Matt W
  • 11,753
  • 25
  • 118
  • 215

1 Answers1

6

D'oh! Turns out I was missing a single -...

"--incognito"
Matt W
  • 11,753
  • 25
  • 118
  • 215