1

We are using FluentAutomation.SeleniumWebDriver to drive our integration tests. We configure this as so

public IntegrationTest()
{
    SeleniumWebDriver.Bootstrap(SeleniumWebDriver.Browser.Chrome);
}

My question is how do I tell it to run in incognito mode? The problem I have is that the tests will sometimes use cookies that I have been using locally and this can affect tests.

Chris
  • 26,744
  • 48
  • 193
  • 345

1 Answers1

0

I'm not sure how to always force it to run in icognito mode, but it might be helpfull that you can always open a new window in incognito mode and use that.

_driver.FindElement(By.TagName("body").SendKeys(Keys.Control + Keys.Shift + "n");

You can switch between windows as following:

//switch to new window.
_driver.SwitchTo().Window(_driver.WindowHandles.Last());
//switch back to your first window
_driver.SwitchTo().Window(_driver.WindowHandles.First());

I know this doesn't give you excatly what you wanted but maybe it can sovle some of your problems.

Simon
  • 306
  • 1
  • 12