public static DesiredCapabilities BuildRemoteCapabilities(DriverConfigurationSection configSection) { switch (configSection.RemoteBrowser.ToLower()) { case "firefox": var capabilities = DesiredCapabilities.Firefox(); capabilities.IsJavaScriptEnabled = true; return(capabilities); case "chrome": return(DesiredCapabilities.Chrome()); case "internet explorer": return(new DesiredCapabilities(new Dictionary <string, object> { { "browserName", "internet explorer" }, { "version", configSection.RemoteBrowserVersion }, { "javascriptEnabled", true } })); default: throw new ApplicationException( string.Format( "Unrecognized remote browser {0}", configSection.RemoteBrowser)); } }
private static IWebDriver BuildPhantomJsBrowser(DriverConfigurationSection configSection) { PhantomJSDriverService service = PhantomJSDriverService.CreateDefaultService(); if (!string.IsNullOrEmpty(configSection.CommandArgument)) { service.AddArgument(configSection.CommandArgument); } var browser = new PhantomJSDriver(service); ApplyPhantomJSHack(browser); return(browser); }
public static IWebDriver Build(DriverConfigurationSection configSection) { switch (configSection.Browser) { case "Firefox": return(new FirefoxDriver()); case "Chrome": CopyChromeDriverServerToLocalDirectory( configSection.ServerSource); return(new ChromeDriver()); case "InternetExplorer": CopyIEDriverServerToLocalDirectory( configSection.ServerSource); return(new InternetExplorerDriver( Directory.GetCurrentDirectory(), new InternetExplorerOptions { IgnoreZoomLevel = true })); case "PhantomJS": CopyPhantomJSServerToLocalDirectory(configSection.ServerSource); var browser = new PhantomJSDriver(); ApplyPhantomJSHack(browser); return(browser); case "Remote": return(new RemoteWebDriver( new Uri(configSection.RemoteUrl), BuildRemoteCapabilities(configSection))); default: throw new ApplicationException( string.Format( "Unable to create a driver of type {0}", configSection.Browser)); } }
private static DesiredCapabilities BuildRemoteCapabilities( DriverConfigurationSection config) { return(DriverFactory.BuildRemoteCapabilities(config)); }