Exemplo n.º 1
0
        protected static void StartDriver()
        {
            try
            {
                ChromeDriverService service = null;
                Blackbaud.UAT.SpecFlow.Selenium.RemoteWebDriver driver = null;

                string remoteUrl = ConfigurationManager.AppSettings["RemoteDriver"];
                if ("false" == remoteUrl.ToLower())
                {
                    service      = BaseTest.InitializeChromeService();
                    Test.service = service;
                    driver       = BaseTest.InitializeChromeDriver(service.ServiceUrl);
                }
                else
                {
                    driver = new Blackbaud.UAT.SpecFlow.Selenium.RemoteWebDriver(new Uri(remoteUrl), DesiredCapabilities.Chrome());
                }

                Test.driver = driver;

                if (Test.service != null)
                {
                    ScenarioContext.Current.Add("Service", service);
                }
                if (Test.driver != null)
                {
                    ScenarioContext.Current.Add("Driver", driver);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                //Do nothing if context is unavailable
            }
        }