/// <summary> /// Gets the sauce labs web driver. /// </summary> /// <param name="browserName">The full browser name.</param> /// <param name="os">The operating system.</param> /// <param name="apiName">The api name.</param> /// <param name="device">The device name.</param> /// <param name="version">The version name.</param> /// <param name="testSettings">The test settings.</param> /// <param name="deviceOrientation">The device orientation.</param> /// <param name="testOutputHelper">The test output helper.</param> /// <returns></returns> /// <exception cref="TestConfigurationException">Selenium settings not set.</exception> public static ITestWebDriver InitializeSauceLabsDriver(string browserName, string os, string apiName, string device, string version, TestSettings testSettings, DeviceOrientation deviceOrientation, ITestOutputHelper testOutputHelper) { ScreenShotCounter = 0; TestOutputHelper = testOutputHelper; testSettings.BrowserName = browserName; if (testSettings.SeleniumHubSettings == null) { throw new TestConfigurationException("SauceLabs settings not set."); } if (testSettings.SeleniumHubSettings.HubUsername == null) { throw new TestConfigurationException("SauceLabs username settings not set."); } if (testSettings.SeleniumHubSettings.HubPassword == null) { throw new TestConfigurationException("SauceLabs access token settings not set."); } var capabilities = SauceLabs.GetDesiredCapability(testSettings.SeleniumHubSettings.HubUsername, testSettings.SeleniumHubSettings.HubPassword, browserName, os, apiName, device, version, deviceOrientation, testSettings); testSettings = ValidateSavePaths(testSettings); var driver = new TestRemoteWebDriver(new Uri(testSettings.SeleniumHubSettings.HubUrl), capabilities, testSettings.TimeoutTimeSpan); var extendedWebDriver = new TestWebDriver(driver, testSettings, TestOutputHelper); TestWebDriver = extendedWebDriver; return(extendedWebDriver); }
/// <summary> /// Gets the sauce labs web driver. /// </summary> /// <param name="browserName">The full browser name.</param> /// <param name="os">The operating system.</param> /// <param name="apiName">The api name.</param> /// <param name="device">The device name.</param> /// <param name="version">The version name.</param> /// <param name="testSettings">The test settings.</param> /// <param name="deviceOrientation">The device orientation.</param> /// <param name="testOutputHelper">The test output helper.</param> /// <returns></returns> /// <exception cref="TestConfigurationException">Selenium settings not set.</exception> public static ITestWebDriver InitializeSauceLabsDriver(string browserName, string os, string apiName, string device, string version, TestSettings testSettings, DeviceOrientation deviceOrientation, ITestOutputHelper testOutputHelper) { ScreenShotCounter = 0; TestOutputHelper = testOutputHelper; testSettings.BrowserName = browserName; if (testSettings.SeleniumHubSettings == null) { throw new TestConfigurationException("SauceLabs settings not set."); } if (testSettings.SeleniumHubSettings.HubUsername == null) { throw new TestConfigurationException("SauceLabs username settings not set."); } if (testSettings.SeleniumHubSettings.HubPassword == null) { throw new TestConfigurationException("SauceLabs access token settings not set."); } var capabilities = SauceLabs.GetDesiredCapability(testSettings.SeleniumHubSettings.HubUsername, testSettings.SeleniumHubSettings.HubPassword, browserName, os, apiName, device, version, deviceOrientation, testSettings); testSettings = ValidateSavePaths(testSettings); var driver = new TestRemoteWebDriver(new Uri(testSettings.SeleniumHubSettings.HubUrl), capabilities, testSettings.TimeoutTimeSpan); var extendedWebDriver = new TestWebDriver(driver, testSettings, TestOutputHelper); TestWebDriver = extendedWebDriver; return extendedWebDriver; }