/// <summary> /// Stops the driver services /// </summary> public void StopDriverServices() { if (EdgeService != null && EdgeService.IsRunning) { EdgeService.Dispose(); } if (IEService != null && IEService.IsRunning) { IEService.Dispose(); } if (ChromeService != null && ChromeService.IsRunning) { ChromeService.Dispose(); } if (FirefoxService != null && FirefoxService.IsRunning) { FirefoxService.Dispose(); } if (OperaService != null && OperaService.IsRunning) { OperaService.Dispose(); } }
internal static IDriverService StartService(WebDriver wd) { ExtendCapabilities(wd, false); FirefoxService svc = new FirefoxService(); svc.Start(wd.Arguments, wd.Preferences, wd.Extensions, wd.Capabilities, wd.Profile, wd.Persistant); return(svc); }
/// <summary> /// Gets the capabilities for FIREFOX /// </summary> /// <param name="_logLevel"></param> /// <param name="_alertBehaviour"></param> /// <param name="acceptSlefSignedSSL"></param> /// <param name="_loadStrategy"></param> /// <returns></returns> private FirefoxOptions GetFirefoxBrowserOptions(FirefoxDriverLogLevel _logLevel = FirefoxDriverLogLevel.Default, UnhandledPromptBehavior _alertBehaviour = UnhandledPromptBehavior.Default, bool acceptSlefSignedSSL = true, PageLoadStrategy _loadStrategy = PageLoadStrategy.Default) { FirefoxService = FirefoxDriverService.CreateDefaultService(Directory.GetCurrentDirectory(), @"geckodriver.exe"); FirefoxService.HideCommandPromptWindow = true; FirefoxService.Start(); return(new FirefoxOptions() { LogLevel = _logLevel, UnhandledPromptBehavior = _alertBehaviour, PageLoadStrategy = _loadStrategy, AcceptInsecureCertificates = acceptSlefSignedSSL, UseLegacyImplementation = true }); }
public void GetBrowserConfiguration() { var browser = string.IsNullOrEmpty(ConfigurationManager.AppSettings["browser"]) ? "firefox" : ConfigurationManager.AppSettings["browser"].ToString(); switch (browser) { case "firefox": { var service = FirefoxService.GetFirefoxService(); seleniumService.Driver = new FirefoxDriver(service); break; } default: { var service = FirefoxService.GetFirefoxService(); seleniumService.Driver = new FirefoxDriver(service); break; } } }