当前位置: 首页>>代码示例>>C#>>正文


C# ChromeOptions.AddAdditionalCapability方法代码示例

本文整理汇总了C#中OpenQA.Selenium.Chrome.ChromeOptions.AddAdditionalCapability方法的典型用法代码示例。如果您正苦于以下问题:C# ChromeOptions.AddAdditionalCapability方法的具体用法?C# ChromeOptions.AddAdditionalCapability怎么用?C# ChromeOptions.AddAdditionalCapability使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenQA.Selenium.Chrome.ChromeOptions的用法示例。


在下文中一共展示了ChromeOptions.AddAdditionalCapability方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BeforeTestRun

 public static void BeforeTestRun()
 {
     ChromeOptions optionChrome = new ChromeOptions();
     optionChrome.AddAdditionalCapability("chrome.noWebsiteTestingDefaults", false);
     optionChrome.AddAdditionalCapability("chrome.applicationCacheEnabled", false);
     Driver = new ChromeDriver();
     Driver.Manage().Cookies.DeleteAllCookies();
     Driver.Manage().Window.Maximize();
     Driver.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, 5));
 }
开发者ID:piotrekkula,项目名称:RyanAir,代码行数:10,代码来源:Events.cs

示例2: PerformInitialize

        /// <summary>
        /// Performs the initialize of the browser.
        /// </summary>
        /// <param name="driverFolder">The driver folder.</param>
        /// <param name="proxy">The proxy.</param>
        /// <returns>
        /// The web driver.
        /// </returns>
        protected override IWebDriver PerformInitialize(string driverFolder, Proxy proxy)
        {
            var options = new ChromeOptions();

            if (!string.IsNullOrWhiteSpace(proxy.HttpProxy))
            {
                options.AddAdditionalCapability(CapabilityType.Proxy, proxy);
            }

            return new ChromeDriver(driverFolder, options);
        }
开发者ID:giacomelli,项目名称:SpecFlowHelper,代码行数:19,代码来源:ChromeBrowser.cs

示例3: CreateWebDriverWithProfiling

 private void CreateWebDriverWithProfiling()
 {
     if (TestUtilities.IsFirefox(driver))
     {
         DesiredCapabilities caps = DesiredCapabilities.Firefox();
         caps.SetCapability(CapabilityType.EnableProfiling, true);
         localDriver = new FirefoxDriver(caps);
     }
     else if (TestUtilities.IsChrome(driver))
     {
         ChromeOptions options = new ChromeOptions();
         options.AddAdditionalCapability(CapabilityType.EnableProfiling, true, true);
         localDriver = new ChromeDriver(options);
         ICapabilities c = ((IHasCapabilities)localDriver).Capabilities;
     }
 }
开发者ID:RanchoLi,项目名称:selenium,代码行数:16,代码来源:AvailableLogsTest.cs

示例4: SetWebDriverToChrome

        private void SetWebDriverToChrome()
        {
            var driver = ChromeDriverService.CreateDefaultService(Browsers + "Chrome" + Helpers._seperator + _chromedriver);

            var settings = new ChromeOptions();
            settings.AddAdditionalCapability(CapabilityType.SupportsFindingByCss, true);
            settings.AddAdditionalCapability(CapabilityType.AcceptSslCertificates, true);

            try
            {
                WebDriver = new ChromeDriver(driver, settings);
            }
            catch (DriverServiceNotFoundException ex)
            {
                throw new DriverServiceNotFoundException(ex.Message);
            }
        }
开发者ID:beeaux,项目名称:automation-frameworks,代码行数:17,代码来源:SharedDriver.cs

示例5: InitializeChromeDriver

        public static RemoteWebDriver InitializeChromeDriver(Uri serviceUrl)
        {
            ChromeOptions options = new ChromeOptions();
            var perfLoggingPrefs = new Dictionary<string, object> { { "enableNetwork", true }, { "enablePage", true }, { "enableTimeline", false } };
            try
            {
                string perf = ConfigurationManager.AppSettings["ChromeDriver.PerfLogging"];
                if ("false" != perf.ToLower())
                {
                    options.AddAdditionalCapability("perfLoggingPrefs", perfLoggingPrefs);
                }
                            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                // Swallow non-existent Configurations
            }

            try
            {
                string mobile = ConfigurationManager.AppSettings["ChromeDriver.MobileEmulationDevice"];
                if ("false" != mobile.ToLower())
                {
                    options.AddAdditionalCapability("mobileEmulation",
                        new Dictionary<string, object> {{"deviceName", mobile}});
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                // Swallow non-existent Configurations
            }

            try
            {
                options.AddArgument("--lang=" + ConfigurationManager.AppSettings["ChromeDriver.language"]);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                // Swallow non-existent Configurations
            }

            DesiredCapabilities capabilities = options.ToCapabilities() as DesiredCapabilities;
            var loggingPrefs = new Dictionary<string, object> { { "performance", "ALL" }, { "browser", "ALL" } };
            try
            {
                string perf = ConfigurationManager.AppSettings["ChromeDriver.PerfLogging"];
                if ("false" != perf.ToLower())
                {
                    capabilities.SetCapability("loggingPrefs", loggingPrefs);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                // Swallow non-existent Configurations
            }

            return new RemoteWebDriver(serviceUrl, capabilities);
        }
开发者ID:Blackbaud-LucasWestervelt,项目名称:uat-kit,代码行数:61,代码来源:BaseTest.cs


注:本文中的OpenQA.Selenium.Chrome.ChromeOptions.AddAdditionalCapability方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。