Пример #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));
        }
Пример #2
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));
        }
        public override DesiredCapabilities FinalizeCapabilities()
        {
            //only set the "version" capability for web browser requests on PCs and MACs
            if (_platform == Platform.Windows || _platform == Platform.Mac || _platform == Platform.Linux)
            {
                // set the version to the expected format:
                if ((!string.IsNullOrWhiteSpace(_targetBrowserVersion)) &&
                    (!string.IsNullOrWhiteSpace(_targetPlatformVersion)))
                {
                    // 11Windows7
                    Capabilities.SetCapability("version",
                                               _targetBrowserVersion + string.Concat(_platform.ToString(), _targetPlatformVersion));
                }
                else if (!string.IsNullOrWhiteSpace(_targetPlatformVersion))
                {
                    // Windows7
                    Capabilities.SetCapability("version", string.Concat(_platform.ToString(), _targetPlatformVersion));
                }
            }

            return(Capabilities);
        }