Matt W
Matt W

Reputation: 12423

Start headless chrome in incognito

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.

Upvotes: 3

Views: 5141

Answers (1)

Matt W
Matt W

Reputation: 12423

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

"--incognito"

Upvotes: 6

Related Questions