public IBrowserDriver Create(BrowserNames browserName) { if (configuration.WebDriver.IsRemote) { switch (browserName) { case BrowserNames.chrome: return(CreateRemoteWebDriver(DesiredCapabilities.Chrome())); case BrowserNames.firefox: return(CreateRemoteWebDriver(DesiredCapabilities.Firefox())); case BrowserNames.opera: return(CreateRemoteWebDriver(DesiredCapabilities.Opera())); case BrowserNames.safari: return(CreateRemoteWebDriver(DesiredCapabilities.Safari())); case BrowserNames.ie: return(CreateRemoteWebDriver(DesiredCapabilities.InternetExplorer())); default: throw new Exception($"Value Not Supported `{browserName}`!"); } } return(driverFactory[browserName](configuration.WebDriver.BrowserDriversPath)); }
public void AddBrowsersNames(List <string> names) { foreach (var name in names) { if (!BrowserNames.Exists(x => x.Name == name)) { BrowserNames.Add(new UsedBrowser(name, false)); } } }
public void TestBrowserNames() { List <BrowserType> browsers = new List <BrowserType>((BrowserType[])Enum.GetValues(typeof(BrowserType))); Assert.AreEqual(17, browsers.Count, "wrong number of browser types"); foreach (BrowserType browser in browsers) { Assert.NotNull(BrowserNames.GetBrowserName(browser), $"{nameof(BrowserType)}.{browser} is not covered by {nameof(BrowserNames)}.{nameof(BrowserNames.GetBrowserName)}"); } Assert.AreEqual(BrowserNames.Chrome, BrowserNames.GetBrowserName(BrowserType.CHROME)); browsers.Remove(BrowserType.CHROME); Assert.AreEqual(BrowserNames.Chrome, BrowserNames.GetBrowserName(BrowserType.CHROME_ONE_VERSION_BACK)); browsers.Remove(BrowserType.CHROME_ONE_VERSION_BACK); Assert.AreEqual(BrowserNames.Chrome, BrowserNames.GetBrowserName(BrowserType.CHROME_TWO_VERSIONS_BACK)); browsers.Remove(BrowserType.CHROME_TWO_VERSIONS_BACK); Assert.AreEqual(BrowserNames.Firefox, BrowserNames.GetBrowserName(BrowserType.FIREFOX)); browsers.Remove(BrowserType.FIREFOX); Assert.AreEqual(BrowserNames.Firefox, BrowserNames.GetBrowserName(BrowserType.FIREFOX_ONE_VERSION_BACK)); browsers.Remove(BrowserType.FIREFOX_ONE_VERSION_BACK); Assert.AreEqual(BrowserNames.Firefox, BrowserNames.GetBrowserName(BrowserType.FIREFOX_TWO_VERSIONS_BACK)); browsers.Remove(BrowserType.FIREFOX_TWO_VERSIONS_BACK); Assert.AreEqual(BrowserNames.Safari, BrowserNames.GetBrowserName(BrowserType.SAFARI)); browsers.Remove(BrowserType.SAFARI); Assert.AreEqual(BrowserNames.Safari, BrowserNames.GetBrowserName(BrowserType.SAFARI_ONE_VERSION_BACK)); browsers.Remove(BrowserType.SAFARI_ONE_VERSION_BACK); Assert.AreEqual(BrowserNames.Safari, BrowserNames.GetBrowserName(BrowserType.SAFARI_TWO_VERSIONS_BACK)); browsers.Remove(BrowserType.SAFARI_TWO_VERSIONS_BACK); Assert.AreEqual(BrowserNames.Safari, BrowserNames.GetBrowserName(BrowserType.SAFARI_EARLY_ACCESS)); browsers.Remove(BrowserType.SAFARI_EARLY_ACCESS); Assert.AreEqual(BrowserNames.IE + " 10", BrowserNames.GetBrowserName(BrowserType.IE_10)); browsers.Remove(BrowserType.IE_10); Assert.AreEqual(BrowserNames.IE + " 11", BrowserNames.GetBrowserName(BrowserType.IE_11)); browsers.Remove(BrowserType.IE_11); Assert.AreEqual(BrowserNames.Edge, BrowserNames.GetBrowserName(BrowserType.EDGE)); browsers.Remove(BrowserType.EDGE); Assert.AreEqual(BrowserNames.Edge, BrowserNames.GetBrowserName(BrowserType.EDGE_LEGACY)); browsers.Remove(BrowserType.EDGE_LEGACY); Assert.AreEqual(BrowserNames.EdgeChromium, BrowserNames.GetBrowserName(BrowserType.EDGE_CHROMIUM)); browsers.Remove(BrowserType.EDGE_CHROMIUM); Assert.AreEqual(BrowserNames.EdgeChromium, BrowserNames.GetBrowserName(BrowserType.EDGE_CHROMIUM_ONE_VERSION_BACK)); browsers.Remove(BrowserType.EDGE_CHROMIUM_ONE_VERSION_BACK); Assert.AreEqual(BrowserNames.EdgeChromium, BrowserNames.GetBrowserName(BrowserType.EDGE_CHROMIUM_TWO_VERSIONS_BACK)); browsers.Remove(BrowserType.EDGE_CHROMIUM_TWO_VERSIONS_BACK); Assert.AreEqual(0, browsers.Count, "Not all browser types names has been verified. Remaining browser types: " + browsers.Concat(", ")); }
/// <summary> /// Determines whether the specified <see cref="FlagsDefinition"/> is equal to the current /// <see cref="FlagsDefinition"/>. /// </summary> /// <param name="other">The <see cref="FlagsDefinition"/> to compare with the current <see cref="FlagsDefinition"/>.</param> /// <returns><c>true</c> if the specified <see cref="FlagsDefinition"/> is equal to the current /// <see cref="FlagsDefinition"/>; otherwise, <c>false</c>.</returns> public bool Equals(FlagsDefinition other) { if (ReferenceEquals(other, null)) { return(false); } return(MinimumVersion == other.MinimumVersion && MaximumVersion == other.MaximumVersion && BrowserNames.SetEquals(other.BrowserNames) && Platforms.SetEquals(other.Platforms) && AddFlags.SetEquals(other.AddFlags) && RemoveFlags.SetEquals(other.RemoveFlags)); }
public IBrowserDriver Create(BrowserNames browserName) { if (configuration.WebDriver.IsRemote) { Log.Info($"WebDriver.IsRemote = {configuration.WebDriver.IsRemote}"); switch (browserName) { case BrowserNames.chrome: return CreateRemoteWebDriver(DesiredCapabilities.Chrome()); case BrowserNames.firefox: return CreateRemoteWebDriver(DesiredCapabilities.Firefox()); case BrowserNames.opera: return CreateRemoteWebDriver(DesiredCapabilities.Opera()); case BrowserNames.safari: return CreateRemoteWebDriver(DesiredCapabilities.Safari()); case BrowserNames.ie: return CreateRemoteWebDriver(DesiredCapabilities.InternetExplorer()); default: throw new ArgumentOutOfRangeException($"SpecDrill: Value Not Supported `{browserName}`!"); } } return driverFactory[browserName](GetBrowserDriversPath()); }
bool DoesBrowserNameMatch(BrowserIdentification browserId) { return(BrowserNames.Any(x => x.Equals(browserId.Name, StringComparison.InvariantCultureIgnoreCase))); }
public IBrowserDriver Create(BrowserNames browserName) { var mode = (configuration?.WebDriver?.Mode ?? "").ToEnum <Modes>(); Log.Info($"Browser mode:{mode}"); switch (mode) { case Modes.browser: var isRemote = configuration?.WebDriver?.Browser?.IsRemote ?? false; Log.Info($"WebDriver.IsRemote = {isRemote}"); if (isRemote) { switch (browserName) { case BrowserNames.chrome: { ChromeOptions chromeOptions = BuildChromeOptions(); return(CreateRemoteWebDriver(chromeOptions.ToCapabilities())); } case BrowserNames.firefox: { FirefoxOptions firefoxOptions = BuildFirefoxOptions(); return(CreateRemoteWebDriver(firefoxOptions.ToCapabilities())); } case BrowserNames.opera: { OperaOptions operaOptions = BuildOperaOptions(); return(CreateRemoteWebDriver(operaOptions.ToCapabilities())); } case BrowserNames.safari: { SafariOptions safariOptions = BuildSafariOptions(); return(CreateRemoteWebDriver(safariOptions.ToCapabilities())); } case BrowserNames.ie: { InternetExplorerOptions ieOptions = BuildInternetExplorerOptions(); return(CreateRemoteWebDriver(ieOptions.ToCapabilities())); } case BrowserNames.edge: { EdgeOptions edgeOptions = BuildEdgeOptions(); return(CreateRemoteWebDriver(edgeOptions.ToCapabilities())); } default: throw new ArgumentOutOfRangeException($"SpecDrill: Value Not Supported `{browserName}`!"); } } return(driverFactory[browserName]()); case Modes.appium: AppiumOptions appiumOptions = new AppiumOptions(); var configuredCapabilities = configuration?.WebDriver?.Appium?.Capabilities; ExtendCapabilities(appiumOptions, configuredCapabilities); IWebDriver driver; const string PLATFORM_NAME = "platformName"; EnsureCapabilityIsConfigured(configuredCapabilities, PLATFORM_NAME); var appiumServerUri = configuration?.WebDriver?.Appium?.ServerUri ?? ""; switch (configuredCapabilities ![PLATFORM_NAME].ToString().ToEnum <PlatformNames>())