public void CanLaodEdge() { IWebDriver edgeDriver = null; try { _driverPath = _externalFiles.GetRepositoryFolder(); edgeDriver = new EdgeDriver(_driverPath); edgeDriver.Navigate().GoToUrl("http://www.bing.com"); var title = edgeDriver.Title; Assert.AreEqual(title, "Bing"); } catch (Exception exception) { if (exception.GetType() == typeof(InvalidOperationException)) { Console.Out.WriteLine("Edge not installed in the system"); } Console.Error.WriteLine(exception); throw; } finally { edgeDriver?.Quit(); } }
public BrowserBase(DriverType driverType) { var externalFiles = new ExternalFiles(); var path = externalFiles.GetRepositoryFolder(); switch (driverType) { case DriverType.Edge: _driver = new EdgeDriver(path); break; case DriverType.Chrome: _driver = new ChromeDriver(path); _driver.Manage().Window.Maximize(); var tabs = _driver.WindowHandles; if (tabs.Count > 1) { _driver.SwitchTo().Window(tabs[1]); _driver.Close(); _driver.SwitchTo().Window(tabs[0]); } break; } }