public virtual DriverOptions Create()
        {
            var browserTypeValue = _configurationReader.GetConfigurationValue(Constants.Configuration.BrowserTypeKey);
            var browserType      = !string.IsNullOrWhiteSpace(browserTypeValue) ? BrowserTypeMapper.ConvertBrowserValue(browserTypeValue) : BrowserTypes.InternetExplorer;

            switch (browserType)
            {
            case BrowserTypes.Firefox:
                return(CreateFirefoxDriverOptions());

            case BrowserTypes.InternetExplorer:
                return(CreateInternetExplorerDriverOptions());

            case BrowserTypes.Chrome:
                return(CreateChromeDriverOptions());

            case BrowserTypes.Edge:
                return(CreateEdgeDriverOptions());

            case BrowserTypes.NotSet:
                return(CreateInternetExplorerDriverOptions());

            default:
                return(CreateInternetExplorerDriverOptions());
            }
        }
Example #2
0
        public virtual IDriverCleanup Create()
        {
            string browserServer;
            string browserProcess;

            var browserTypeValue = _configurationReader.GetConfigurationValue(Constants.Configuration.BrowserTypeKey);
            var browserType      = !string.IsNullOrWhiteSpace(browserTypeValue) ? BrowserTypeMapper.ConvertBrowserValue(browserTypeValue) : BrowserTypes.InternetExplorer;

            switch (browserType)
            {
            case Enums.BrowserTypes.InternetExplorer:
                browserProcess = Enums.BrowserTypes.InternetExplorer.GetDescription();
                browserServer  = BrowserDriverServer.InternetExplorer;
                break;

            case Enums.BrowserTypes.Chrome:
                browserProcess = Enums.BrowserTypes.Chrome.GetDescription();
                browserServer  = BrowserDriverServer.Chrome;
                break;

            case Enums.BrowserTypes.Firefox:
                browserProcess = Enums.BrowserTypes.Firefox.GetDescription();
                browserServer  = BrowserDriverServer.Firefox;
                break;

            default:
                browserProcess = Enums.BrowserTypes.InternetExplorer.GetDescription();
                browserServer  = BrowserDriverServer.InternetExplorer;
                break;
            }

            return(new DriverCleanup(browserServer, browserProcess, _osProcess, _configurationReader));
        }
        public virtual IWebDriver Create()
        {
            IWebDriver driver;
            var        loginWaitTime = Convert.ToInt64(ConfigurationReader.GetConfigurationValue(Constants.Configuration.LoginWaitTimeKey));

            var browserTypeValue = ConfigurationReader.GetConfigurationValue(Constants.Configuration.BrowserTypeKey);
            var browserType      = !string.IsNullOrWhiteSpace(browserTypeValue) ? BrowserTypeMapper.ConvertBrowserValue(browserTypeValue) : BrowserTypes.Chrome;

            var cfgSeleniumGridUrl = ConfigurationReader.GetConfigurationValue(Constants.Configuration.SeleniumGridUrlKey);
            var seleniumGridUrl    = string.IsNullOrEmpty(cfgSeleniumGridUrl) ? Configuration.DefaultSeleniumUrl : cfgSeleniumGridUrl;
            var commandTimeout     = TimeSpan.FromMinutes(1);
            var driverOptions      = BrowserOptionsFactory.Create();

            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); //https://github.com/SeleniumHQ/selenium/issues/4816
            driver = new RemoteWebDriver(new Uri(seleniumGridUrl), driverOptions.ToCapabilities(), commandTimeout);
            //ffService.Host = "::1";
            return(driver);
        }
        public virtual IWebDriver Create()
        {
            IWebDriver driver;
            var        loginWaitTime = Convert.ToInt64(ConfigurationReader.GetConfigurationValue(Constants.Configuration.LoginWaitTimeKey));

            var browserTypeValue = ConfigurationReader.GetConfigurationValue(Constants.Configuration.BrowserTypeKey);
            var browserType      = !string.IsNullOrWhiteSpace(browserTypeValue) ? BrowserTypeMapper.ConvertBrowserValue(browserTypeValue) : BrowserTypes.InternetExplorer;

            switch (browserType)
            {
            case BrowserTypes.Firefox:
                driver = CreateFirefoxWebDriver(loginWaitTime);
                break;

            case BrowserTypes.InternetExplorer:
                driver = CreateInternetExplorerWebDriver(loginWaitTime);
                break;

            case BrowserTypes.Chrome:
                driver = CreateChromeWebDriver(loginWaitTime);
                break;

            case BrowserTypes.Edge:
                driver = CreateEdgeWebDriver(loginWaitTime);
                break;

            case BrowserTypes.NotSet:
                driver = CreateInternetExplorerWebDriver(loginWaitTime);
                break;

            default:
                driver = CreateInternetExplorerWebDriver(loginWaitTime);
                break;
            }

            return(driver);
        }