public SeleniumBrowser(ISeleniumDriverFactory seleniumDriverFactory, ISweetPotatoSettings sweetPotatoSettings,
                               ISeleniumElementFactory seleniumElementFactory)
        {
            _seleniumElementFactory = seleniumElementFactory;
            _sweetPotatoSettings    = sweetPotatoSettings;
            var browserType = sweetPotatoSettings.GetBrowserType();

            _webDriver = seleniumDriverFactory.Create(browserType, sweetPotatoSettings.GetDriverPath());
            Elements   = new List <ElementLookup>();
        }
Exemple #2
0
        public IAutomationBrowser CreateBrowser(ISweetPotatoSettings sweetPotatoSettings)
        {
            ScenarioContext.Current.Set(sweetPotatoSettings.GetExecutingAssemblyName(),
                                        Constants.ImplementingAssemblyName);
            //ScenarioContext.Current.Set(sweetPotatoSettings.GetWaitTimeMilliseconds(),
            //    Constants.WaitTimeMilliseconds);
            //ScenarioContext.Current.Set(sweetPotatoSettings.IsElementHighlighterEnabled(),
            //    Constants.IsElementHighlighterEnabled);

            switch (sweetPotatoSettings.GetDriverType())
            {
            case DriverType.Selenium:
                var automationBrowser = GetSeleniumBrowser(sweetPotatoSettings);
                SetAutomationBrowserToScenarioContext(automationBrowser);
                return(automationBrowser);

            default:
                var seleniumBrowser = GetSeleniumBrowser(sweetPotatoSettings);
                SetAutomationBrowserToScenarioContext(seleniumBrowser);
                return(seleniumBrowser);
            }
        }
Exemple #3
0
        private static IAutomationBrowser GetSeleniumBrowser(ISweetPotatoSettings sweetPotatoSettings)
        {
            var seleniumDriverFactory = new SeleniumDriverFactory();

            return(new SeleniumBrowser(seleniumDriverFactory, sweetPotatoSettings, new SeleniumElementFactory()));
        }