Powered By Blogger

Search Here!

Saturday, July 14, 2012

WebdriverBackedSelenium in C# using WebDriver !

Using WebDriverBackedSelenium with different browser(s) setting contains the .NET bindings for the older, more procedural Selenium Remote Control (or Selenium RC) API, but implemented using the newer WebDriver technology. It does not require a running instance of the Selenium Server.

if (Browser.Equals("IE"))
            {
                string ieDriverPath = ConfigurationManager.AppSettings["ieDriverPath"];
                var options = new InternetExplorerOptions { IntroduceInstabilityByIgnoringProtectedModeSettings = true };
                WebDriver = new InternetExplorerDriver(ieDriverPath, options);
                BackedSelenium = new WebDriverBackedSelenium(WebDriver, ConfigurationManager.AppSettings["browserUrl"]);
                BackedSelenium.Start();
WebDriver.Navigate().GoToUrl(ConfigurationManager.AppSettings["browserUrl"]);

            }
            if (Browser.Equals("Firefox"))
            {
                WebDriver = new FirefoxDriver();
                BackedSelenium = new WebDriverBackedSelenium(WebDriver, ConfigurationManager.AppSettings["browserUrl"]);
                BackedSelenium.Start();
WebDriver.Navigate().GoToUrl(ConfigurationManager.AppSettings["browserUrl"]);
            }
            if (Browser.Equals("Safari"))
            {
                WebDriver = new SafariDriver();
                BackedSelenium = new WebDriverBackedSelenium(WebDriver, ConfigurationManager.AppSettings["browserUrl"]);
                BackedSelenium.Start();
WebDriver.Navigate().GoToUrl(ConfigurationManager.AppSettings["browserUrl"]);
            }

1 comment: