I am trying to run a test on multiple browsers using WebDriver, Nunit and C#. It's working, but I am getting that annoying security warning in Chrome. In an effort to fix it, I need to re-create the driver using ".AddArguments("--test-type"); ". But I only want to do this if this iterations browser = Chrome. Here is my code. It works, but it launches an un-needed browser window first. Anybody have any idea's around this?
namespace SeleniumTests { [TestFixture(typeof(FirefoxDriver))] [TestFixture(typeof(InternetExplorerDriver))] [TestFixture(typeof(ChromeDriver))] public class TestWithMultipleBrowsers<TWebDriver> where TWebDriver : IWebDriver, new() { private IWebDriver driver; [SetUp] public void CreateDriver() { this.driver = new TWebDriver(); //Creates a window that needs to be closed and re-constructed if(driver is ChromeDriver) { driver.Quit(); //This kills the un-needed driver window created above var chromeOptions = new ChromeOptions(); chromeOptions.AddArguments("--test-type"); driver = new ChromeDriver(chromeOptions); } }