Example #1
0
        /// <summary>
        /// Starts up a new session using the test suite defaults, but overriding the browser and platform together with version
        /// </summary>
        /// <param name="browser"></param>
        /// <param name="browserVersion"></param>
        /// <param name="platform"></param>
        /// <param name="platformVersion"></param>
        /// <param name="siteUrl"></param>
        /// <returns></returns>
        protected ISession StartUpSession(Browser browser, string browserVersion, Platform platform, string platformVersion, string siteUrl)
        {
            TestSuiteSettings.WebDriverSettings.Browser.Value   = browser.ToString();
            TestSuiteSettings.WebDriverSettings.Platform.Value  = platform.ToString();
            TestSuiteSettings.WebDriverSettings.BrowserVersion  = browserVersion;
            TestSuiteSettings.WebDriverSettings.PlatformVersion = platformVersion;

            return(StartUpSession(TestSuiteSettings, siteUrl));
        }
        public InternalCapabilityProvider(DriverSettings driverSettings) : base(driverSettings)
        {
            BrowserDefaults(driverSettings.Browser.EnumValue);

            // if the version is set to latest or *, do nothing
            if (driverSettings.BrowserVersion != "Latest" && driverSettings.BrowserVersion != "*")
            {
                _targetBrowserVersion = driverSettings.BrowserVersion;
            }

            _platform = driverSettings.Platform.EnumValue;

            switch (_platform)
            {
            case Platform.Mac:
            {
                Capabilities.Platform = new OpenQA.Selenium.Platform(PlatformType.Mac);
                break;
            }

            case Platform.Windows:
            {
                Capabilities.Platform = new OpenQA.Selenium.Platform(PlatformType.Windows);
                break;
            }

            case Platform.Linux:
            {
                Capabilities.Platform = new OpenQA.Selenium.Platform(PlatformType.Linux);
                break;
            }

            case Platform.iOS:
            {
                Capabilities.SetCapability("platformVersion", driverSettings.PlatformVersion);
                Capabilities.SetCapability("platformName", driverSettings.Platform.EnumValue);
                break;
            }

            case Platform.Android:
            {
                Capabilities.Platform = new OpenQA.Selenium.Platform(PlatformType.Android);
                Capabilities.SetCapability("platformVersion", driverSettings.PlatformVersion);
                Capabilities.SetCapability("platformName", driverSettings.Platform.EnumValue);
                break;
            }
            }

            // if the version is set to latest or *, do nothing
            if (driverSettings.PlatformVersion != "Latest" && driverSettings.PlatformVersion != "*")
            {
                _targetPlatformVersion = driverSettings.PlatformVersion;
            }
        }
Example #3
0
        /// <summary>
        /// Starts up a new session using the test suite defaults, but overriding the browser and platform together with version
        /// </summary>
        /// <param name="browser"></param>
        /// <param name="browserVersion"></param>
        /// <param name="platform"></param>
        /// <param name="platformVersion"></param>
        /// <param name="startPage"></param>
        /// <param name="launchPageHandler"></param>
        /// <returns></returns>
        protected ISession StartUpSession(Browser browser, string browserVersion, Platform platform, string platformVersion, int startPage, ILaunchPageHandler launchPageHandler)
        {
            var launchPage = TestSuiteSettings.GetLaunchPage(startPage, launchPageHandler);

            TestSuiteSettings.WebDriverSettings.Browser.Value   = browser.ToString();
            TestSuiteSettings.WebDriverSettings.Platform.Value  = platform.ToString();
            TestSuiteSettings.WebDriverSettings.BrowserVersion  = browserVersion;
            TestSuiteSettings.WebDriverSettings.PlatformVersion = platformVersion;

            return(StartUpSession(TestSuiteSettings, launchPage));
        }