Ejemplo n.º 1
0
        public static IWebDriver Create(string browser)
        {
            DesiredCapabilities capabilities;
            IWebDriver          driver;

            switch (browser)
            {
            case "chrome":
                capabilities = DesiredCapabilities.Chrome();
                driver       = new RemoteWebDriver(RemoteWebDriverUri, capabilities);
                break;

            case "internet explorer":
                InternetExplorerOptions options = new InternetExplorerOptions();
                options.IgnoreZoomLevel = true;
                capabilities            = (DesiredCapabilities)options.ToCapabilities();
                driver = new RemoteWebDriver(RemoteWebDriverUri, capabilities, TimeSpan.FromSeconds(10));
                break;

            case "edge":
                capabilities = DesiredCapabilities.Edge();
                driver       = new RemoteWebDriver(RemoteWebDriverUri, capabilities);
                break;

            default:
                capabilities = DesiredCapabilities.Firefox();
                driver       = new RemoteWebDriver(RemoteWebDriverUri, capabilities);
                break;
            }

            return(driver);
        }
Ejemplo n.º 2
0
        private static void SetDesiredCapablities(string deviceOrbrowser)
        {
            switch (deviceOrbrowser.ToLower())
            {
            case "chrome":
                capabillities = DesiredCapabilities.Chrome();
                break;

            case "firefox":
                capabillities = DesiredCapabilities.Firefox();
                break;

            case "edge":
                capabillities = DesiredCapabilities.Edge();
                break;

            case "ipad":
                capabillities = DesiredCapabilities.IPad();
                break;

            case "iphone":
                capabillities = DesiredCapabilities.IPhone();
                break;

            case "ie":
            case "internetexplorer":
                capabillities = DesiredCapabilities.InternetExplorer();
                break;

            default:
                break;
            }
        }
Ejemplo n.º 3
0
        private static ICapabilities GetBrowserCapabilities(BrowserType driverType)
        {
            switch (driverType)
            {
            case BrowserType.Firefox:
                return(DesiredCapabilities.Firefox());

            case BrowserType.Chrome:
                return(DesiredCapabilities.Chrome());

            case BrowserType.InternetExplorer:
                return(DesiredCapabilities.InternetExplorer());

            case BrowserType.Opera:
                return(DesiredCapabilities.Opera());

            case BrowserType.Safari:
                return(DesiredCapabilities.Safari());

            case BrowserType.Phantom:
                return(DesiredCapabilities.PhantomJS());

            case BrowserType.Edge:
                return(DesiredCapabilities.Edge());

            default:
                throw new ArgumentOutOfRangeException(nameof(driverType), driverType, null);
            }
        }
Ejemplo n.º 4
0
        public static void StartWeb()
        {
            capabillities = new DesiredCapabilities();
            webLocators   = LocatorHelper.LoadLocators("locators/locators.csv");
            var browser = ConfigurationManager.AppSettings.Get("Browser");

            switch (browser.ToLower())
            {
            case "chrome":
                capabillities = DesiredCapabilities.Chrome();
                StartChromeDriver();
                break;

            case "firefox":
                capabillities = DesiredCapabilities.Firefox();
                StartFireFoxDriver();
                break;

            case "edge":
                capabillities = DesiredCapabilities.Edge();
                StartEdgeDriver();
                break;

            case "htmlunit":
                capabillities = DesiredCapabilities.HtmlUnit();
                StartHtmlUnitDriver();
                break;

            default:
                break;
            }
        }
        private DesiredCapabilities GetCapabilitiesFor(string browserName)
        {
            switch (browserName)
            {
            case "internet explorer":
                return(DesiredCapabilities.InternetExplorer());

            case "chrome":
                return(DesiredCapabilities.Chrome());

            case "firefox":
                return(DesiredCapabilities.Firefox());

            case "MicrosoftEdge":
                return(DesiredCapabilities.Edge());

            case "androidchrome":
                return(new DesiredCapabilities());

            case "safari":
                return(DesiredCapabilities.Safari());

            case "safariIphone7":
                return(new DesiredCapabilities());

            default:
                return(null);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Returns DesiredCapabilities for Edge with these options included as
        /// capabilities. This copies the options. Further changes will not be
        /// reflected in the returned capabilities.
        /// </summary>
        /// <returns>The DesiredCapabilities for Edge with these options.</returns>
        public ICapabilities ToCapabilities()
        {
            DesiredCapabilities capabilities = DesiredCapabilities.Edge();

            if (this.pageLoadStrategy != EdgePageLoadStrategy.Default)
            {
                string pageLoadStrategySetting = "normal";
                switch (this.pageLoadStrategy)
                {
                case EdgePageLoadStrategy.Eager:
                    pageLoadStrategySetting = "eager";
                    break;

                case EdgePageLoadStrategy.None:
                    pageLoadStrategySetting = "none";
                    break;
                }

                capabilities.SetCapability(CapabilityType.PageLoadStrategy, pageLoadStrategySetting);
            }

            foreach (KeyValuePair <string, object> pair in this.additionalCapabilities)
            {
                capabilities.SetCapability(pair.Key, pair.Value);
            }

            return(capabilities);
        }
Ejemplo n.º 7
0
        public static IWebDriver StartDriver(Config.Browser browser, TimeSpan timeout, Uri remoteWebDriverUri)
        {
            IWebDriver driver = null;

            switch (browser)
            {
            case Config.Browser.Chrome:
            {
                driver = new RemoteWebDriver(remoteWebDriverUri, DesiredCapabilities.Chrome());
                break;
            }

            case Config.Browser.Edge:
            {
                driver = new RemoteWebDriver(remoteWebDriverUri, DesiredCapabilities.Edge());
                break;
            }

            case Config.Browser.Firefox:
            {
                driver = new RemoteWebDriver(remoteWebDriverUri, DesiredCapabilities.Firefox());
                break;
            }
            }

            IWebDriver eventDriver = new WebDriverEventListener(driver);

            driver = eventDriver;
            driver.Manage().Window.Maximize();
            driver.Manage().Timeouts().PageLoad = timeout;
            driver.Manage().Timeouts().AsynchronousJavaScript = timeout;
            return(driver);
        }
Ejemplo n.º 8
0
        public ICapabilities ToCapabilities()
        {
            DesiredCapabilities desiredCapabilities = DesiredCapabilities.Edge();

            if (this.pageLoadStrategy != EdgePageLoadStrategy.Default)
            {
                string capabilityValue = "normal";
                switch (this.pageLoadStrategy)
                {
                case EdgePageLoadStrategy.Eager:
                    capabilityValue = "eager";
                    break;

                case EdgePageLoadStrategy.None:
                    capabilityValue = "none";
                    break;
                }
                desiredCapabilities.SetCapability(CapabilityType.PageLoadStrategy, capabilityValue);
            }
            foreach (KeyValuePair <string, object> current in this.additionalCapabilities)
            {
                desiredCapabilities.SetCapability(current.Key, current.Value);
            }
            return(desiredCapabilities);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Get the remote desired capability
        /// </summary>
        /// <returns>The remote desired capability</returns>
        private static DesiredCapabilities GetRemoteCapabilities()
        {
            DesiredCapabilities capabilities = null;
            string remoteBrowser             = GetRemoteBrowserName();
            string remotePlatform            = GetRemotePlatform();
            string remoteBrowserVersion      = GetRemoteBrowserVersion();

            switch (remoteBrowser.ToUpper())
            {
            case "INTERNET EXPLORER":
            case "INTERNETEXPLORER":
            case "IE":
                capabilities = DesiredCapabilities.InternetExplorer();
                break;

            case "FIREFOX":
                capabilities = DesiredCapabilities.Firefox();
                break;

            case "CHROME":
                capabilities = DesiredCapabilities.Chrome();
                break;

            case "EDGE":
                capabilities = DesiredCapabilities.Edge();
                break;

            case "SAFARI":
                capabilities = DesiredCapabilities.Safari();
                break;

            default:
                throw new Exception(StringProcessor.SafeFormatter("Remote browser type '{0}' is not supported", remoteBrowser));
            }

            // Add a platform setting if one was provided
            if (remotePlatform.Length > 0)
            {
                capabilities.SetCapability("platform", remotePlatform);
            }

            // Add a remote browser setting if one was provided
            if (remoteBrowserVersion.Length > 0)
            {
                capabilities.SetCapability("version", remoteBrowserVersion);
            }

            // Add RemoteCapabilites section if it exists
            capabilities.SetRemoteCapabilities();

            return(capabilities);
        }
Ejemplo n.º 10
0
        public static DesiredCapabilities GetCapability(TestConfiguration configuration)
        {
            DesiredCapabilities capab = null;

            switch (configuration.Browser.ToUpper())
            {
            case "FIREFOX":
                capab = DesiredCapabilities.Firefox();
                break;

            case "CHROME":
                capab = DesiredCapabilities.Chrome();
                break;

            case "IEXPLORER":
            case "INTERNET EXPLORER":
            case "INTERNET":
                capab = DesiredCapabilities.InternetExplorer();
                break;

            case "EDGE":
                capab = DesiredCapabilities.Edge();
                break;

            case "SAFARI":
                capab = DesiredCapabilities.Safari();
                break;

            case "ANDROID":
                capab = DesiredCapabilities.Android();
                break;

            case "IPAD":
                capab = DesiredCapabilities.IPad();
                break;

            case "IPHONE":
                capab = DesiredCapabilities.IPhone();
                break;

            default:
                capab = DesiredCapabilities.Firefox();
                break;
            }

            capab.IsJavaScriptEnabled = true;
            capab.SetCapability(CapabilityType.Version, configuration.BrowserVersion);
            capab.SetCapability(CapabilityType.Platform, configuration.Platform);
            capab.SetCapability("build", configuration.BuildName);
            return(capab);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Returns an instance of the web driver based on test browser.
        /// </summary>
        /// <returns>The browser driver.</returns>
        public static IWebDriver GetInstance()
        {
            IWebDriver webDriver = null;

            if (_isRemote)
            {
                DesiredCapabilities remoteCapability;
                switch (_browserName)
                {
                // get browser driver based on browserName
                case PegasusBaseTestFixture.InternetExplorer: remoteCapability = DesiredCapabilities.InternetExplorer(); break;

                case PegasusBaseTestFixture.FireFox: remoteCapability = DesiredCapabilities.Firefox(); break;

                case PegasusBaseTestFixture.Safari: remoteCapability = DesiredCapabilities.Safari(); break;

                case PegasusBaseTestFixture.Chrome: var chromeOptions = new ChromeOptions();
                    chromeOptions.AddArgument("disable-popup-blocking");
                    remoteCapability = (DesiredCapabilities)chromeOptions.ToCapabilities();
                    break;

                case PegasusBaseTestFixture.Edge: remoteCapability = DesiredCapabilities.Edge(); break;

                default: throw new ArgumentException("The suggested browser was not found");
                }
                // object representing the image of the page on the screen
                webDriver = new ScreenShotRemoteWebDriver(new Uri(_remoteHubUrl), remoteCapability,
                                                          commandTimeout: TimeSpan.FromSeconds(TimeOut));
                webDriver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(TimeOut));
            }
            else
            {
                switch (_browserName)
                {
                // get browser driver based on browserName
                case PegasusBaseTestFixture.InternetExplorer: webDriver = IeWebDriver(); break;

                case PegasusBaseTestFixture.FireFox: webDriver = FireFoxWebDriver(); break;

                case PegasusBaseTestFixture.Safari: webDriver = SafariWebDriver(); break;

                case PegasusBaseTestFixture.Chrome: webDriver = ChromeWebDriver(); break;

                case PegasusBaseTestFixture.Edge: webDriver = EdgeWebDriver(); break;

                default: throw new ArgumentException("The suggested browser was not found");
                }
            }
            return(webDriver);
        }
Ejemplo n.º 12
0
        public static DesiredCapabilities FindDesiredCapabilities(this BrowserType browserType)
        {
            DesiredCapabilities capability;

            switch (browserType)
            {
            case BrowserType.IE:
                capability = DesiredCapabilities.InternetExplorer();
                break;

            case BrowserType.FireFox:
                capability = DesiredCapabilities.Firefox();
                break;

            case BrowserType.Chrome:
                capability = DesiredCapabilities.Chrome();
                break;

            case BrowserType.Safari:
                capability = DesiredCapabilities.Safari();
                break;

            case BrowserType.Opera:
                capability = DesiredCapabilities.Opera();
                break;

            case BrowserType.Android:
                capability = DesiredCapabilities.Android();
                break;

            case BrowserType.iPhone:
                capability = DesiredCapabilities.IPhone();
                break;

            case BrowserType.iPad:
                capability = DesiredCapabilities.IPad();
                break;

            case BrowserType.Edge:
                capability = DesiredCapabilities.Edge();
                break;

            default:
                throw new InvalidOperationException(
                          $"Browser Type '{browserType}' is not supported as a remote driver.");
            }
            return(capability);
        }
        private IWebDriver GetEdgeDriver()
        {
            IWebDriver d;

            if (Settings.isLocal)
            {
                EdgeOptions options = new EdgeOptions();

                d = new EdgeDriver(URL.driver, options);
                return(d);
            }
            else
            {
                DesiredCapabilities capabilities = DesiredCapabilities.Edge();
                var uri = new Uri(URL.devSeleniumHub);
                d = new RemoteWebDriverPlus(uri, capabilities, TimeSpan.FromSeconds(120));
                return(d);
            }
        }
Ejemplo n.º 14
0
        private IWebDriver GetRemoteDriver(Browser browserType)
        {
            TestConfiguration testConfiguration = TestConfiguration.GetInstance();
            String            gridUrl           = testConfiguration.GetSeleniumGridURL();

            DesiredCapabilities desiredCapabilities = null;

            switch (browserType)
            {
            case Browser.CHROME:
                desiredCapabilities = DesiredCapabilities.Chrome();
                break;

            case Browser.EDGE:
                desiredCapabilities = DesiredCapabilities.Edge();
                break;

            case Browser.FIREFOX:
                desiredCapabilities = DesiredCapabilities.Firefox();
                break;

            case Browser.INTERNET_EXPLORER:
                desiredCapabilities = DesiredCapabilities.InternetExplorer();
                break;

            case Browser.PHANTOMJS:
                desiredCapabilities = DesiredCapabilities.PhantomJS();
                break;
            }
            desiredCapabilities.SetCapability("platform", "LINUX");

            try
            {
                return(new RemoteWebDriver(new Uri(testConfiguration.GetSeleniumGridURL()), desiredCapabilities));
            }
            catch (SystemException e)
            {
                throw new SystemException(e.Message);
            }
        }
Ejemplo n.º 15
0
        //Creates a remote webdriver
        private static IWebDriver CreateRemoteDriver(BrowserConfig config)
        {
            Uri huburl = new Uri(config.Huburl);

            switch (config.Browsername)
            {
            case BrowserNames.Firefox:
                return(new RemoteWebDriver(huburl, DesiredCapabilities.Firefox()));

            case BrowserNames.Chrome:
                return(new RemoteWebDriver(huburl, DesiredCapabilities.Chrome()));

            case BrowserNames.IE11:
                return(new RemoteWebDriver(huburl, GetRemoteIe11Capabilities()));

            case BrowserNames.Edge:
                return(new RemoteWebDriver(huburl, DesiredCapabilities.Edge()));

            default:
                throw new Exception("Unsupported browser type");
            }
        }
Ejemplo n.º 16
0
        private static IWebDriver StartDriver()
        {
            string driversPath = Path.Combine(Directory.GetCurrentDirectory(), "Drivers");

            if (!Grid)
            {
                switch (Name)
                {
                case "IE":
                    webDriver = new InternetExplorerDriver(driversPath);
                    break;

                case "Edge":
                    webDriver = new EdgeDriver(driversPath);
                    break;

                case "Chrome":
                    //handle unable to maximized chrome on some envs
                    //ChromeOptions chromeOptions = new ChromeOptions();
                    //chromeOptions.AddArguments("start-maximized");
                    //currentDriver = new ChromeDriver(driversPath,chromeOptions);
                    webDriver = new ChromeDriver(driversPath);
                    break;

                case "Firefox":
                    System.Environment.SetEnvironmentVariable("webdriver.gecko.driver", driversPath);
                    //handle crash dialog
                    //System.Environment.SetEnvironmentVariable("XRE_NO_WINDOWS_CRASH_DIALOG", "1");
                    webDriver = new FirefoxDriver();
                    break;

                default:
                    throw new Exception($"{Driver.Name} is invalid. {nameof(Driver.Name)} only accepts IE, Edge, Chrome or Firefox.");
                }
            }
            else
            {
                DesiredCapabilities capability = new DesiredCapabilities();
                switch (Name)
                {
                case "Edge":
                    capability = DesiredCapabilities.Edge();
                    capability.SetCapability(CapabilityType.BrowserName, "MicrosoftEdge");
                    capability.SetCapability(CapabilityType.Version, "38");
                    capability.SetCapability("platform", "WIN10");
                    //capability.SetCapability("initialBrowserUrl", "");
                    break;

                case "IE":
                    capability = DesiredCapabilities.InternetExplorer();
                    capability.SetCapability("browserName", "MicrosoftEdge");
                    capability.SetCapability("platform", "Win10");
                    //capability.SetCapability("initialBrowserUrl", "");
                    break;

                case "Safari":
                    capability = DesiredCapabilities.Safari();
                    capability.SetCapability("browserName", "safari");
                    capability.SetCapability(CapabilityType.Version, "10");
                    capability.SetCapability("platform", "MAC");
                    //capability.SetCapability("initialBrowserUrl", "");
                    break;

                case "Chrome":
                    capability = DesiredCapabilities.Chrome();
                    capability.SetCapability("browserName", "chrome");
                    //capability.SetCapability(CapabilityType.Version, "57");
                    capability.SetCapability("platform", "WIN10");
                    //capability.SetCapability("api_key", "api_key");
                    //capability.SetCapability("api_secret", "api_secret");

                    break;

                case "Firefox":
                    capability = DesiredCapabilities.Firefox();
                    System.Environment.SetEnvironmentVariable("webdriver.gecko.driver", driversPath);
                    capability.SetCapability("browserName", "firefox");
                    capability.SetCapability("platform", "WIN10");
                    break;

                default:
                    Console.WriteLine("Browser name is null.");
                    break;
                }

                webDriver = new RemoteWebDriver(new Uri(HubUrl), capability);
                webDriver.Manage().Window.Maximize();
            }
            return(webDriver);
        }
Ejemplo n.º 17
0
        protected void BrowserDefaults(Browser eBrowser)
        {
            switch (eBrowser)
            {
            case Browser.Chrome:
            {
                Capabilities = DesiredCapabilities.Chrome();
                //creating custom profile to avoid download file dialogs etc.
                var chromeOptions = new ChromeOptions();
                chromeOptions.AddUserProfilePreference("download.default_directory", _driverSettings.DownloadDirectory);
                chromeOptions.AddUserProfilePreference("download.prompt_for_download", false);
                chromeOptions.AddUserProfilePreference("disable-popup-blocking", true);
                Capabilities = chromeOptions.ToCapabilities() as DesiredCapabilities;
                Capabilities.SetCapability(CapabilityType.UnexpectedAlertBehavior, "ignore");
                break;
            }

            case Browser.Firefox:
            {
                Capabilities = DesiredCapabilities.Firefox();
                Capabilities.SetCapability(CapabilityType.UnexpectedAlertBehavior, "ignore");
                //creating custom profile to avoid download file dialogs etc.
                var profile = new FirefoxProfile();
                profile.SetPreference("browser.download.dir", _driverSettings.DownloadDirectory);
                profile.SetPreference("browser.download.folderList", 2);
                profile.SetPreference("browser.helperApps.neverAsk.saveToDisk",
                                      "image/jpeg, application/pdf, application/octet-stream");
                profile.SetPreference("pdfjs.disabled", true);
                //setting the custom profile into the capabilities.
                Capabilities.SetCapability(FirefoxDriver.ProfileCapabilityName, profile.ToBase64String());
                break;
            }

            case Browser.Opera:
            {
                Capabilities = DesiredCapabilities.Opera();
                Capabilities.SetCapability(CapabilityType.UnexpectedAlertBehavior, "ignore");
                break;
            }

            case Browser.InternetExplorer:
            {
                Capabilities = DesiredCapabilities.InternetExplorer();
                Capabilities.SetCapability("EnableNativeEvents", true);
                Capabilities.SetCapability("EnablePersistentHover", true);
                Capabilities.SetCapability("RequireWindowFocus", true);
                Capabilities.SetCapability(CapabilityType.UnexpectedAlertBehavior, "ignore");
                break;
            }

            case Browser.Edge:
            {
                Capabilities = DesiredCapabilities.Edge();
                Capabilities.SetCapability(CapabilityType.UnexpectedAlertBehavior, "ignore");
                break;
            }

            case Browser.Safari:
            {
                Capabilities = DesiredCapabilities.Safari();
                Capabilities.SetCapability(CapabilityType.UnexpectedAlertBehavior, "ignore");
                Capabilities.IsJavaScriptEnabled = true;
                break;
            }

            case Browser.Unspecified:
            {
                Capabilities = new DesiredCapabilities();
                break;
            }

            default:
            {
                throw new ArgumentException("Unexpected browser specified");
            }
            }
        }
Ejemplo n.º 18
0
        public static DesiredCapabilities getCapabilities(String browserString)
        {
            DesiredCapabilities capabilities = new DesiredCapabilities();

            //Determine Browser Type
            if (browserString.Contains("FIREFOX"))
            {
                capabilities = DesiredCapabilities.Firefox();
            }
            else if (browserString.Contains("CHROME"))
            {
                capabilities = DesiredCapabilities.Chrome();
            }
            else if (browserString.Contains("IE"))
            {
                capabilities = DesiredCapabilities.InternetExplorer();
            }
            else if (browserString.Contains("EDGE"))
            {
                capabilities = DesiredCapabilities.Edge();
            }
            else if (browserString.Contains("SAFARI"))
            {
                capabilities = DesiredCapabilities.Safari();
            }
            else
            {
                capabilities = DesiredCapabilities.Firefox();
                System.Console.WriteLine("There is no browser with the provided name. Defaulting to Firefox.");
            }

            //Determine Browser Version
            if (browserString.Contains("IE_9"))
            {
                capabilities.SetCapability("version", "9.0");
            }
            else if (browserString.Contains("IE_10"))
            {
                capabilities.SetCapability("version", "10.0");
            }
            else if (browserString.Contains("IE_11"))
            {
                capabilities.SetCapability("version", "11.0");
            }

            //Determine Operating System
            if (browserString.Contains("WIN_7"))
            {
                capabilities.SetCapability("platform", "Windows 7");
            }
            else if (browserString.Contains("WIN_8_1"))
            {
                capabilities.SetCapability("platform", "Windows 8.1");
            }
            else if (browserString.Contains("WIN_8"))
            {
                capabilities.SetCapability("platform", "Windows 8");
            }
            else if (browserString.Contains("WIN_10"))
            {
                capabilities.SetCapability("platform", "Windows 10");
            }
            else if (browserString.Contains("OSX_11"))
            {
                capabilities.SetCapability("platform", "OS X 10.11");
            }
            else if (browserString.Contains("OSX_10"))
            {
                capabilities.SetCapability("platform", "OS X 10.10");
            }
            else if (browserString.Contains("OSX_9"))
            {
                capabilities.SetCapability("platform", "OS X 10.9");
            }
            else
            {
                capabilities.SetCapability("platform", "Windows 7");
                System.Console.WriteLine("There is no operating system with the provided name. Defaulting to Windows 7.");
            }

            return(capabilities);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Checks to see if settings for the remote driver exists.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="browserType">Type of the browser.</param>
        /// <param name="remoteWebDriver">The created remote web driver.</param>
        /// <returns><c>true</c> if the settings exist; otherwise <c>false</c>.</returns>
        private static bool RemoteDriverExists(NameValueConfigurationCollection settings, BrowserType browserType, out IWebDriver remoteWebDriver)
        {
            var remoteUri = GetRemoteDriverUri(settings);

            if (remoteUri == null)
            {
                remoteWebDriver = null;
                return(false);
            }

            DesiredCapabilities capability;

            switch (browserType)
            {
            case BrowserType.IE:
                capability = DesiredCapabilities.InternetExplorer();
                break;

            case BrowserType.FireFox:
                capability = DesiredCapabilities.Firefox();
                break;

            case BrowserType.Chrome:
                capability = DesiredCapabilities.Chrome();
                break;

            case BrowserType.Safari:
                capability = DesiredCapabilities.Safari();
                break;

            case BrowserType.Opera:
                capability = DesiredCapabilities.Opera();
                break;

            case BrowserType.Android:
                capability = DesiredCapabilities.Android();
                break;

            case BrowserType.iPhone:
                capability = DesiredCapabilities.IPhone();
                break;

            case BrowserType.iPad:
                capability = DesiredCapabilities.IPad();
                break;

            case BrowserType.PhantomJS:
                capability = DesiredCapabilities.PhantomJS();
                break;

            case BrowserType.Edge:
                capability = DesiredCapabilities.Edge();
                break;

            default:
                throw new InvalidOperationException(string.Format("Browser Type '{0}' is not supported as a remote driver.", browserType));
            }

            // Add any additional settings that are not reserved
            var reservedSettings = new[] { RemoteUrlSetting };

            foreach (var setting in settings.OfType <NameValueConfigurationElement>()
                     .Where(s => reservedSettings.All(r => !string.Equals(r, s.Name, StringComparison.OrdinalIgnoreCase))))
            {
                capability.SetCapability(setting.Name, setting.Value);
            }

            remoteWebDriver = new RemoteScreenshotWebDriver(remoteUri, capability);
            return(true);
        }