public static Configurator GetConfiguratorInstance() { return(_configuratorInstance ?? (_configuratorInstance = new Configurator())); }
private void InstantiateRepository() { var connectionString = Configurator.GetConfiguratorInstance().GetDBConnectionString(); _reportRepository = new SQLReportRepository(connectionString); }
public static void SetUp() { var browser = Configurator.GetConfiguratorInstance().GetBrowser(); var runInHeadlessMode = Configurator.GetConfiguratorInstance().GetRunBrowserInHeadlessMode(); switch (browser) { case "firefox": var firefoxOptions = new FirefoxOptions { AcceptInsecureCertificates = true, UnhandledPromptBehavior = UnhandledPromptBehavior.Accept }; if (runInHeadlessMode) { firefoxOptions.AddArguments("--headless"); } webDriver = new FirefoxDriver(firefoxOptions); webDriver.Manage().Window.Maximize(); break; case "chrome": // JC - checkthis out to see if works var chromeOptions = new ChromeOptions { AcceptInsecureCertificates = true, UnhandledPromptBehavior = UnhandledPromptBehavior.Accept }; if (runInHeadlessMode) { chromeOptions.AddArguments("headless"); } webDriver = new ChromeDriver(chromeOptions); break; case "ie": webDriver = new InternetExplorerDriver(); webDriver.Manage().Window.Maximize(); break; //--- This driver is not supported at this moment. This will be revisited in future --- //case "htmlunit" : // WebDriver = new RemoteWebDriver(DesiredCapabilities.HtmlUnitWithJavaScript()); // break; case "browserstack": webDriver = new BrowserStackDriver(ScenarioContext.Current).Init("single", Configurator.GetConfiguratorInstance().GetBrowserStackBrowser()); break; case "phantomjs": //http://executeautomation.com/blog/running-chrome-in-headless-mode-with-selenium-c/ //https://stackoverflow.com/questions/48887128/running-selenium-tests-in-chrome-headless-mode-on-a-vsts-hosted-agent webDriver = new PhantomJSDriver(); break; case "zapProxyChrome": InitialiseZapProxyChrome(); break; default: throw new Exception("Driver name does not match OR this framework does not support the WebDriver specified"); } webDriver.Manage().Window.Maximize(); webDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); webDriver.Manage().Cookies.DeleteAllCookies(); String currentWindow = webDriver.CurrentWindowHandle; webDriver.SwitchTo().Window(currentWindow); PageInteractionHelper.SetDriver(webDriver); pageFactory = new PageFactory(webDriver); }
protected string GetPageUrl(string page) { return(Configurator.GetConfiguratorInstance().GetBaseUrl() + Configurator.GetConfiguratorInstance().GetEmployerId() + page); }