private IWebDriver GetEdgeDriver() { return(new EdgeDriver(EdgeDriverService.CreateDefaultService()) { Url = _webServerDriver.Hostname }); }
private IWebDriver GetEdgeDriver() { return(new EdgeDriver(EdgeDriverService.CreateDefaultService(_testRunContext.TestDirectory)) { Url = _configurationDriver.SeleniumBaseUrl, }); }
public static Task <IWebDriver> GetEdgeDriverAsync() { var options = new EdgeOptions() { PageLoadStrategy = PageLoadStrategy.Eager, UnhandledPromptBehavior = UnhandledPromptBehavior.Accept, UseInPrivateBrowsing = true }; var pathsToCheck = new[] { Path.Combine("C:", "Windows", "SysWOW64"), Path.Combine( Environment.CurrentDirectory, "Drivers") }; var driverFileName = "MicrosoftWebDriver.exe"; var pathToUse = pathsToCheck .First(x => File.Exists( Path.Combine(x, driverFileName))); var service = EdgeDriverService.CreateDefaultService( pathToUse, driverFileName, 52296); var driver = new EdgeDriver(service, options); return(Task.FromResult <IWebDriver>(driver)); }
public IWebDriver getWebDriver(String browser_name) { Platform current = Platform.CurrentPlatform; String brname = browser_name.ToUpper(); String path = System.Reflection.Assembly.GetCallingAssembly().CodeBase; String actualPath = path.Substring(0, path.LastIndexOf("bin")); String projectPath = new Uri(actualPath).LocalPath; String chromepath = projectPath + "Lib\\chromedriver.exe"; String geckopath = projectPath + "Lib\\geckodriver.exe"; String edgepath = projectPath + "Lib\\msedgedriver.exe"; switch (Enum.Parse(typeof(WebBrowserType), brname)) { case WebBrowserType.FIREFOX: FirefoxDriverService service = FirefoxDriverService.CreateDefaultService("webdriver.gecko.driver", geckopath); driver = new FirefoxDriver(service); driver.Manage().Window.Maximize(); return(driver); case WebBrowserType.EDGE: EdgeDriverService edservice = EdgeDriverService.CreateDefaultService("webdriver.edge.driver", edgepath); driver = new EdgeDriver(edservice); driver.Manage().Window.Maximize(); return(driver); case WebBrowserType.CHROME: ChromeDriverService chservice = ChromeDriverService.CreateDefaultService("webdriver.chrome.driver", chromepath); driver = new ChromeDriver(chservice); driver.Manage().Window.Maximize(); return(driver); default: throw new Exception("Browser type unsupported"); } }
private static DriverService CreateEdgeDriverService(BrowserSettings browserSettings, string binariesPath) { /****************************************************************** * For Windows 10 after OS version 17134: install MicrosoftWebDriver as a Feature on Demand, insead of a download: * https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ * DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0 * ***************************************************************/ var edgeDriverService = EdgeDriverService.CreateDefaultService(binariesPath, "MicrosoftWebDriver.exe"); edgeDriverService.HideCommandPromptWindow = browserSettings.HideCommandPromptWindow; edgeDriverService.Port = 17556; edgeDriverService.SuppressInitialDiagnosticInformation = false; if (Debugger.IsAttached) { /************************************************************** * There is no setting for LogFile/LogPath! We do not expect to see a service log. * ***********************************************************/ //var logPath = Path.Combine(binariesPath, DriverType.MicrosoftEdge.ToDescription() + ".log"); edgeDriverService.UseVerboseLogging = browserSettings.EnableVerboseLogging; } return(edgeDriverService); }
/// <summary> /// Amazonから商品と価格を調べる /// </summary> /// <param name="pSearchValue"></param> public void Execute(string pSearchValue) { try { // ドライバが存在する場合は終了させる DriverKill(); // デフォルトサービス設定(ドライバを指定するexeは"MicrosoftWebDriver.exe"固定みたい) var eService = EdgeDriverService.CreateDefaultService(AppDir, "MicrosoftWebDriver.exe"); // コマンドプロンプト非表示 eService.HideCommandPromptWindow = true; // オプション設定 var eOptions = new EdgeOptions { PageLoadStrategy = (PageLoadStrategy)EdgePageLoadStrategy.Normal }; // ドライバ生成 WebDriver = new EdgeDriver(eService, eOptions); // URLセット WebDriver.Url = TargetURL; // 表示されるまで待つ WebDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(4); // ページタイトルに検索結果が含まれるまで ExecuteScript <IWebDriver>(WebDriver, $"document.getElementsByName('field-keywords')[0].value = \"{pSearchValue}\""); // 検索ボタンをクリック var eWebElement = WebDriver.FindElement(By.ClassName("nav-input")); eWebElement.Submit(); // 検索結果のページが読み込み完了するまで待機する var eDriverWait = new WebDriverWait(WebDriver, TimeSpan.FromSeconds(20)); eDriverWait.Until(ExpectedConditions.TitleContains(pSearchValue)); // 商品ごとのXPath var eByPath = By.XPath("//span[contains(@class, 'a-size-base-plus a-color-base a-text-normal')]"); // 商品一覧 var eProducts = WebDriver.FindElements(eByPath); foreach (var eProduct in eProducts) { // 商品から4つ上がって価格を調べる IWebElement parent = eProduct.FindElement(By.XPath("../../../..")); // 価格の要素を取得する var ePrice = parent.FindElement(By.ClassName("a-price-whole")); // コンソール出力 Console.WriteLine($"商品名:{eProduct.Text} 価格:{ePrice.Text}"); } } catch (Exception eException) { // コンソール出力 Console.WriteLine(eException.Message); // デバッグログ出力 Debug.WriteLine(eException.Message); } finally { // ドライバの終了 WebDriver.Quit(); } }
private IWebDriver CreateWebDriver() { // Edge var EdgeService = EdgeDriverService.CreateDefaultService(); return(new EdgeDriver()); }
private static ITestWebDriver CreateEdgeDriver(TestSettings testSettings, int browserVersion) { string driverLocation = GetMultiBrowserDriverBasePath(); driverLocation = Path.Combine(driverLocation, "EdgeDrivers", browserVersion.ToString(), "MicrosoftWebDriver.exe"); driverLocation = ValidateDriverPresentOrUnblocked(WebDriverType.EdgeDriver, driverLocation); testSettings.BrowserName = "Edge " + browserVersion; var driverService = EdgeDriverService.CreateDefaultService(Path.GetDirectoryName(driverLocation), Path.GetFileName(driverLocation)); var options = new EdgeOptions(); var driver = new EdgeDriver(driverService, options, testSettings.TimeoutTimeSpan); if (testSettings.DeleteAllCookies) { driver.Manage().Cookies.DeleteAllCookies(); } driver.Manage().Timeouts().ImplicitWait = testSettings.TimeoutTimeSpan; if (testSettings.MaximiseBrowser) { driver.Manage().Window.Maximize(); } var extendedWebDriver = new TestWebDriver(driver, testSettings, TestOutputHelper); TestWebDriver = extendedWebDriver; return(extendedWebDriver); }
public void EdgeChromium() { _edgeService = EdgeDriverService.CreateDefaultService(_buildPath, @"msedgedriver.exe"); _edgeService.UseVerboseLogging = true; _edgeService.UseSpecCompliantProtocol = true; _edgeService.Start(); var argsList = new List <string> { "use-fake-ui-for-media-stream", "use-fake-device-for-media-stream", "log-level=1" }; #pragma warning disable 618 var capabilities = new DesiredCapabilities(new Dictionary <string, object>() #pragma warning restore 618 { { "ms:edgeOptions", new Dictionary <string, object>() { { "binary", EdgeBrowserExePath }, { "args", argsList } } } }); _driver = new RemoteWebDriver(_edgeService.ServiceUrl, capabilities); RunTest(); }
static JDBuyer() { var service = EdgeDriverService.CreateDefaultService(@"C:\Users\Stone\Documents\GitHub\AutoBuyer\AutoBuyer\AutoBuyer\bin\Debug\netcoreapp3.1\DriversApplication", "msedgedriver.exe"); string s = AppDomain.CurrentDomain.BaseDirectory + @"DriversApplication\msedgedriver.exe"; driver = new EdgeDriver(service); }
Uri IDriverService.Start() { _edgeService = EdgeDriverService.CreateDefaultService(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"msedgedriver.exe"); _edgeService.UseVerboseLogging = true; _edgeService.UseSpecCompliantProtocol = true; _edgeService.Start(); return(_edgeService.ServiceUrl); }
/// <summary> /// Creates the edge driver. /// </summary> /// <returns>IWebDriver.</returns> private static IWebDriver CreateEdgeDriver() { var service = EdgeDriverService.CreateDefaultService(); //option.("-headless"); //lack of the feature ref: https://github.com/SeleniumHQ/selenium/issues/5984 return(new EdgeDriver(service)); }
public static EdgeDriver CreateEdgeDriver() { var driverInfo = new DriverInfo(); var driverOptions = new EdgeOptions(); var driverService = EdgeDriverService.CreateDefaultService(driverInfo.File.DirectoryName, driverInfo.File.Name, driverInfo.Port); return(new EdgeDriver(driverService, driverOptions, TimeSpan.FromSeconds(15))); }
/// <summary> /// Returns a running instance of Edge driver /// </summary> /// <returns></returns> private EdgeDriverService GetEdgeService() { EdgeService = EdgeDriverService.CreateDefaultService(Directory.GetCurrentDirectory(), GetEdgeExecutableDriver()); EdgeService.UseVerboseLogging = true; EdgeService.HideCommandPromptWindow = false; EdgeService.Start(); return(EdgeService); }
private static IWebDriver GetEdgeDriver() { var service = EdgeDriverService.CreateDefaultService(Configuration.EdgeBinPath); var driver = new EdgeDriver(service); driver.Manage().Window.Maximize(); return(driver); }
public static IWebDriver Create() { IWebDriver driver = null; switch (GetBrowser()) { case Browser.Chrome: driver = new ChromeDriver(DriverPath, DefaultChromeOptions()); break; case Browser.Firefox: var ffds = FirefoxDriverService.CreateDefaultService(DriverPath, "geckodriver.exe"); driver = new FirefoxDriver(ffds); MaximizeWindow(driver); break; case Browser.Edge: var edgeDriverService = EdgeDriverService.CreateDefaultService(DriverPath, "MicrosoftWebDriver.exe"); driver = new EdgeDriver(edgeDriverService); MaximizeWindow(driver); break; case Browser.Ie11: var ie11DriverService = InternetExplorerDriverService.CreateDefaultService(DriverPath, "IEDriverServer.exe"); driver = new InternetExplorerDriver(ie11DriverService, DefaultIe11Options()); MaximizeWindow(driver); break; case Browser.RemoteChrome: driver = RemoteWebDriver(DefaultChromeOptions().ToCapabilities()); break; case Browser.RemoteFirefox: driver = RemoteWebDriver(new FirefoxOptions().ToCapabilities()); MaximizeWindow(driver); break; case Browser.RemoteEdge: var edgeCapabilities = new EdgeOptions(); driver = RemoteWebDriver(edgeCapabilities.ToCapabilities()); MaximizeWindow(driver); break; case Browser.RemoteIe11: driver = RemoteWebDriver(DefaultIe11Options().ToCapabilities()); MaximizeWindow(driver); break; default: Assert.Inconclusive($"Browser: {GetBrowser()} is not supported"); break; } driver.SetDefaultImplicitWait(); return(driver); }
/// <summary> /// Creates the web driver from the specified browser factory configuration. /// </summary> /// <returns>The configured web driver.</returns> protected override IWebDriver CreateLocalDriver() { var edgeOptions = new EdgeOptions { PageLoadStrategy = EdgePageLoadStrategy.Normal }; var edgeDriverService = EdgeDriverService.CreateDefaultService(); return(new EdgeDriver(edgeDriverService, edgeOptions)); }
private static EdgeDriver GetEdgeDriver() { EdgeDriverService edgeDriverService = EdgeDriverService.CreateDefaultService(); edgeDriverService.HideCommandPromptWindow = true; EdgeDriver edgeDriver = new EdgeDriver(edgeDriverService); return(edgeDriver); }
public static IWebDriver CreateWebDriver(BrowserOptions options) { IWebDriver driver; switch (options.BrowserType) { case BrowserType.Chrome: var chromeService = ChromeDriverService.CreateDefaultService(); chromeService.HideCommandPromptWindow = options.HideDiagnosticWindow; driver = new ChromeDriver(chromeService, options.ToChrome()); break; case BrowserType.IE: var ieService = InternetExplorerDriverService.CreateDefaultService(); ieService.SuppressInitialDiagnosticInformation = options.HideDiagnosticWindow; driver = new InternetExplorerDriver(ieService, options.ToInternetExplorer(), TimeSpan.FromMinutes(20)); break; case BrowserType.Firefox: var ffService = FirefoxDriverService.CreateDefaultService(); ffService.HideCommandPromptWindow = options.HideDiagnosticWindow; driver = new FirefoxDriver(ffService); driver.Manage().Timeouts().ImplicitWait = new TimeSpan(0, 0, 5); break; case BrowserType.PhantomJs: driver = new PhantomJSDriver(options.DriversPath); break; case BrowserType.Edge: var edgeService = EdgeDriverService.CreateDefaultService(); edgeService.HideCommandPromptWindow = options.HideDiagnosticWindow; driver = new EdgeDriver(edgeService, options.ToEdge(), TimeSpan.FromMinutes(20)); break; default: throw new InvalidOperationException( $"The browser type '{options.BrowserType}' is not recognized."); } driver.Manage().Timeouts().PageLoad = options.PageLoadTimeout; if (options.StartMaximized && options.BrowserType != BrowserType.Chrome) //Handle Chrome in the Browser Options { driver.Manage().Window.Maximize(); } if (options.FireEvents || options.EnableRecording) { // Wrap the newly created driver. driver = new EventFiringWebDriver(driver); } return(driver); }
public static EdgeDriverService GetEdgeDriverService() { var driverService = EdgeDriverService.CreateDefaultService("C:\\Windows\\SysWOW64\\", "MicrosoftWebDriver.exe", 52296); driverService.HideCommandPromptWindow = true; driverService.SuppressInitialDiagnosticInformation = true; return(driverService); }
private static IWebDriver CreateWebDriver() { // Edge var EdgeService = EdgeDriverService.CreateDefaultService(); return(new EdgeDriver()); ////IE //var IEService = InternetExplorerDriverService.CreateDefaultService(); //return new InternetExplorerDriver(IEService); }
/// <summary> /// Instantiates a RemoteWebDriver instance based on the browser passed to this method. Opens the browser and maximizes its window. /// </summary> /// <param name="browser">The browser to get instantiate the Web Driver for.</param> /// <param name="browserProfilePath">The folder path to the browser user profile to use with the browser.</param> /// <returns>The RemoteWebDriver of the browser passed in to the method.</returns> public static RemoteWebDriver CreateDriverAndMaximize(string browser, string browserProfilePath = "") { // Create a webdriver for the respective browser, depending on what we're testing. RemoteWebDriver driver = null; switch (browser) { case "opera": case "operabeta": OperaOptions oOption = new OperaOptions(); oOption.AddArgument("--disable-popup-blocking"); oOption.AddArgument("--power-save-mode=on"); // TODO: This shouldn't be a hardcoded path, but Opera appeared to need this speficied directly to run well oOption.BinaryLocation = @"C:\Program Files (x86)\Opera\launcher.exe"; if (browser == "operabeta") { // TODO: Ideally, this code would look inside the Opera beta folder for opera.exe // rather than depending on flaky hard-coded version in directory oOption.BinaryLocation = @"C:\Program Files (x86)\Opera beta\38.0.2220.25\opera.exe"; } driver = new OperaDriver(oOption); break; case "firefox": driver = new FirefoxDriver(); break; case "chrome": ChromeOptions option = new ChromeOptions(); option.AddUserProfilePreference("profile.default_content_setting_values.notifications", 1); if (!string.IsNullOrEmpty(browserProfilePath)) { option.AddArgument("--user-data-dir=" + browserProfilePath); } driver = new ChromeDriver(option); break; default: // Warning: this blows away all Microsoft Edge data, including bookmarks, cookies, passwords, etc EdgeDriverService svc = EdgeDriverService.CreateDefaultService(); driver = new EdgeDriver(svc); Thread.Sleep(2000); HttpClient client = new HttpClient(); client.DeleteAsync($"http://localhost:{svc.Port}/session/{driver.SessionId}/ms/history").Wait(); break; } driver.Manage().Window.Maximize(); Thread.Sleep(1000); return(driver); }
public void OpenAppEgde() { EdgeDriverService service = EdgeDriverService.CreateDefaultService("C:\\Program Files (x86)\\Microsoft WebDriver", "MicrosoftWebDriver.exe"); //EdgeOptions options = new EdgeOptions(); //options.PageLoadStrategy = EdgePageLoadStrategy.Eager; driver = new EdgeDriver(service); driver.Url = "https://www.google.com.ua/"; driver.Close(); }
private EdgeDriverService GetEdgeDriverService() { DriverService = EdgeDriverService.CreateDefaultService(); if (Options.HideDriverWindow) { DriverService.HideCommandPromptWindow = true; } return((EdgeDriverService)DriverService); }
public IWebDriver Resolve(WebBrowserConfiguration webBrowserConfiguration) { dynamic option = Setcapabilites(webBrowserConfiguration); EdgeDriverService service = EdgeDriverService.CreateDefaultService(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); System.Environment.SetEnvironmentVariable("webdriver.edge.driver", Assembly.GetEntryAssembly().Location); RemoteWebDriver driver = new EdgeDriver(service, option); driver.Manage().Window.Maximize(); return(driver); }
private static IWebDriver CreateWebDriver(SeleniumWebDriverType type) { IWebDriver webDriver; switch (type) { case SeleniumWebDriverType.Edge: var edgeOptions = new EdgeOptions(); edgeOptions.AddAdditionalCapability(CapabilityType.AcceptSslCertificates, true); var edgeDriverService = EdgeDriverService.CreateDefaultService(AppContext.BaseDirectory); webDriver = new ThreadLocal <IWebDriver>(() => new EdgeDriver(edgeDriverService, edgeOptions)).Value; break; case SeleniumWebDriverType.Firefox: var firefoxProfile = new FirefoxProfile { AcceptUntrustedCertificates = true }; var firefoxOptions = new FirefoxOptions { Profile = firefoxProfile }; var firefoxDriverService = FirefoxDriverService.CreateDefaultService(AppContext.BaseDirectory); webDriver = new ThreadLocal <IWebDriver>(() => new FirefoxDriver(firefoxDriverService, firefoxOptions, TimeSpan.FromSeconds(60))).Value; break; case SeleniumWebDriverType.GoogleChrome: var chromeOptions = new ChromeOptions(); chromeOptions.AddArgument("--ignore-certificate-errors"); var chromeDriverService = ChromeDriverService.CreateDefaultService(AppContext.BaseDirectory); webDriver = new ThreadLocal <IWebDriver>(() => new ChromeDriver(chromeDriverService, chromeOptions)).Value; break; case SeleniumWebDriverType.InternetExplorer: var internetExplorerOptions = new InternetExplorerOptions(); internetExplorerOptions.AddAdditionalCapability(CapabilityType.AcceptSslCertificates, true); var internetExplorerDriverService = InternetExplorerDriverService.CreateDefaultService(AppContext.BaseDirectory); webDriver = new ThreadLocal <IWebDriver>(() => new InternetExplorerDriver(internetExplorerDriverService, internetExplorerOptions)).Value; break; default: throw new NullReferenceException("WebDriver is null."); } webDriver.Manage().Window.Maximize(); return(webDriver); }
/// <summary> /// Only ctor /// </summary> /// <param name="searchTimeout">How long to search for elements</param> public DriverManager(TimeSpan searchTimeout) { try { _driver = new EdgeDriver(EdgeDriverService.CreateDefaultService(DriverExecutablePath, "MicrosoftWebDriver.exe", 17556)); } catch (InvalidOperationException) { Console.WriteLine("Unable to start a WebDriver session. Ensure that the previous server window is closed."); Environment.Exit(1); } _searchTimeout = searchTimeout; }
public static void InitBrowser(BrowserType browserType) { int commandTimeOut = 10; switch (browserType) { case BrowserType.Chrome: ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.AddAdditionalCapability(CapabilityType.AcceptInsecureCertificates, true, true); chromeOptions.AddAdditionalCapability(CapabilityType.AcceptSslCertificates, true, true); driver = new ChromeDriver(ChromeDriverService.CreateDefaultService(), chromeOptions, TimeSpan.FromMinutes(commandTimeOut)); break; case BrowserType.Edge: EdgeOptions edgeOptions = new EdgeOptions(); edgeOptions.AddAdditionalCapability(CapabilityType.AcceptInsecureCertificates, true); edgeOptions.AddAdditionalCapability(CapabilityType.AcceptSslCertificates, true); driver = new EdgeDriver(EdgeDriverService.CreateDefaultService(), edgeOptions, TimeSpan.FromMinutes(commandTimeOut)); break; case BrowserType.Firefox: FirefoxOptions ffOptions = new FirefoxOptions(); ffOptions.AddAdditionalCapability(CapabilityType.AcceptInsecureCertificates, true, true); ffOptions.AddAdditionalCapability(CapabilityType.AcceptSslCertificates, true, true); driver = new FirefoxDriver(FirefoxDriverService.CreateDefaultService(), ffOptions, TimeSpan.FromMinutes(commandTimeOut)); break; case BrowserType.InternetExplorer: InternetExplorerOptions ieOptions = new InternetExplorerOptions(); ieOptions.AddAdditionalCapability(CapabilityType.AcceptInsecureCertificates, false, false); ieOptions.AddAdditionalCapability(CapabilityType.AcceptSslCertificates, true, true); ieOptions.IgnoreZoomLevel = true; driver = new InternetExplorerDriver(InternetExplorerDriverService.CreateDefaultService(), ieOptions, TimeSpan.FromMinutes(commandTimeOut)); break; default: throw new NotImplementedException("BrowserType not implemented"); } driver.Manage().Timeouts().PageLoad.Add(System.TimeSpan.FromSeconds(60)); driver.Manage().Cookies.DeleteAllCookies(); driver.Manage().Window.Maximize(); }
public static IWebDriver OpenBrowser(IWebDriver driver) { string pathWebdriver = ConfigurationManager.AppSettings.GetValues("SP_WebDrivers")[0]; string nameBrowser = ConfigurationManager.AppSettings.GetValues("SA_Browser")[0]; string url = ConfigurationManager.AppSettings.GetValues("SA_Url")[0]; string pathLocalBrowser = string.Empty; if (driver == null) { switch (nameBrowser) { case "internet Explorer": InternetExplorerDriverService serviceIE = InternetExplorerDriverService.CreateDefaultService(pathWebdriver, "IEDriverServer.exe"); driver = new InternetExplorerDriver(serviceIE); break; case "internet Edge": EdgeDriverService serviceEdge = EdgeDriverService.CreateDefaultService(pathWebdriver, "MicrosoftWebDriver.exe"); driver = new EdgeDriver(serviceEdge); break; case "firefox": if (File.Exists(@"C:\Program Files\Mozilla Firefox\firefox.exe")) { pathLocalBrowser = @"C:\Program Files\Mozilla Firefox\firefox.exe"; } else { pathLocalBrowser = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe"; } FirefoxDriverService serviceFireFox = FirefoxDriverService.CreateDefaultService(pathWebdriver); serviceFireFox.FirefoxBinaryPath = pathLocalBrowser; driver = new FirefoxDriver(serviceFireFox); break; case "chrome": ChromeDriverService serviceChrome = ChromeDriverService.CreateDefaultService(pathWebdriver, "chromedriver.exe"); driver = new ChromeDriver(serviceChrome); break; } } return(driver); }
public void Start() { switch (BaseConfiguration.TestBrowser) { case BrowserType.Firefox: if (!string.IsNullOrEmpty(BaseConfiguration.FirefoxBrowserExecutableLocation)) { this.FirefoxOptions.BrowserExecutableLocation = BaseConfiguration.FirefoxBrowserExecutableLocation; } this.driver = string.IsNullOrEmpty(BaseConfiguration.PathToFirefoxDriverDirectory) ? new FirefoxDriver(this.SetDriverOptions(this.FirefoxOptions)) : new FirefoxDriver(BaseConfiguration.PathToFirefoxDriverDirectory, this.SetDriverOptions(this.FirefoxOptions)); break; case BrowserType.InternetExplorer: case BrowserType.IE: this.driver = string.IsNullOrEmpty(BaseConfiguration.PathToInternetExplorerDriverDirectory) ? new InternetExplorerDriver(this.SetDriverOptions(this.InternetExplorerOptions)) : new InternetExplorerDriver(BaseConfiguration.PathToInternetExplorerDriverDirectory, this.SetDriverOptions(this.InternetExplorerOptions)); break; case BrowserType.Chrome: if (!string.IsNullOrEmpty(BaseConfiguration.ChromeBrowserExecutableLocation)) { this.ChromeOptions.BinaryLocation = BaseConfiguration.ChromeBrowserExecutableLocation; } this.driver = string.IsNullOrEmpty(BaseConfiguration.PathToChromeDriverDirectory) ? new ChromeDriver(this.SetDriverOptions(this.ChromeOptions)) : new ChromeDriver(BaseConfiguration.PathToChromeDriverDirectory, this.SetDriverOptions(this.ChromeOptions)); break; case BrowserType.Safari: this.driver = new SafariDriver(this.SetDriverOptions(this.SafariOptions)); this.CheckIfProxySetForSafari(); break; case BrowserType.RemoteWebDriver: this.SetupRemoteWebDriver(); break; case BrowserType.Edge: this.driver = new EdgeDriver(EdgeDriverService.CreateDefaultService(BaseConfiguration.PathToEdgeDriverDirectory, "MicrosoftWebDriver.exe", 52296), this.SetDriverOptions(this.EdgeOptions)); break; default: throw new NotSupportedException( string.Format(CultureInfo.CurrentCulture, "Driver {0} is not supported", BaseConfiguration.TestBrowser)); } if (BaseConfiguration.EnableEventFiringWebDriver) { this.driver = new MyEventFiringWebDriver(this.driver); } }