public static IWebDriver GetInstance() { if (driver == null) { TestConfigurations configs = TestConfigurations.GetInstance(); if (TestConfigurations.Browser == chrome) { ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.AcceptInsecureCertificates = true; driver = new ChromeDriver(); } else if (TestConfigurations.Browser == firefox) { var profileManager = new FirefoxProfileManager(); FirefoxProfile profile = profileManager.GetProfile("myNewProfile"); profile.AcceptUntrustedCertificates = true; FirefoxOptions options = new FirefoxOptions(); options.Profile = profile; driver = new FirefoxDriver(options); } else if (TestConfigurations.Browser == internetExplorer) { driver = new InternetExplorerDriver(); } else { throw new Exception("Invalid browser in the settings"); } } return(driver); }
public static TestConfigurations GetInstance() { if (configs == null) { lock (obj) { if (configs == null) { GetConfigs(); configs = new TestConfigurations(); } } } return(configs); }