Example #1
0
        protected static void StartDriver()
        {
            try
            {
                ChromeDriverService service = null;
                RemoteWebDriver     driver  = null;

                String remoteUrl = "false";

                try
                {
                    remoteUrl = ConfigurationManager.AppSettings["RemoteDriver"];
                }
                catch
                {
                    // do nothing if no configuration present.
                }


                if ("false" == remoteUrl.ToLower())
                {
                    service      = BaseTest.InitializeChromeService();
                    Test.service = service;
                    driver       = new RemoteWebDriver(service.ServiceUrl, getOptions());
                }
                else
                {
                    driver = new RemoteWebDriver(new Uri(remoteUrl), getOptions());
                }

                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
            }
        }
Example #2
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
            }
        }