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


C# ChromeOptions.AddExcludedArgument方法代码示例

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


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

示例1: _CreateInstance

        private static IWebDriver _CreateInstance(DesiredCapabilities caps, Drivers driver)
        {
            IWebDriver _webdriver = null;
            if (caps == null) {
                //
                // Loaded default caps for RemoteWebDriver from Selenium.Tests.dll.config in current Dll directory
                // See brian.ku about user/key
                //
                caps = new DesiredCapabilities();
                caps.SetCapability("browserstack.user", ConfigurationManager.AppSettings["browserstack.user"]);
                caps.SetCapability("browserstack.key", ConfigurationManager.AppSettings["browserstack.key"]);
                caps.SetCapability("browser", ConfigurationManager.AppSettings["browser"]);
                caps.SetCapability("browser_version", ConfigurationManager.AppSettings["browser_version"]);
                caps.SetCapability("os", ConfigurationManager.AppSettings["os"]);
                caps.SetCapability("os_version", ConfigurationManager.AppSettings["os_version"]);
                caps.SetCapability("resolution", ConfigurationManager.AppSettings["resolution"]);
                caps.SetCapability("browserstack.debug", ConfigurationManager.AppSettings["browserstack.debug"]);
                caps.SetCapability("browserstack.local", ConfigurationManager.AppSettings["browserstack.local"]);
            }
            switch (driver) {
            case Drivers.IEDriver:
                InternetExplorerDriverService ieService = InternetExplorerDriverService.CreateDefaultService();
                _webdriver = new InternetExplorerDriver(ieService, new InternetExplorerOptions(), TimeSpan.FromSeconds(3 * 60));
                break;
            case Drivers.ChromeDriver:
                ChromeOptions chromeOptions = new ChromeOptions();
                chromeOptions.AddExcludedArgument("ignore-certifcate-errors");
                chromeOptions.AddArgument("test-type");
                _webdriver = new ChromeDriver(chromeOptions);
                _webdriver.Manage().Window.Maximize();
                break;
            case Drivers.FirefoxDriver:
                FirefoxProfile profile = new FirefoxProfile();
                _webdriver = new FirefoxDriver(profile);
                _webdriver.Manage().Window.Maximize();
                break;
            case Drivers.BrowserStack:
                caps.SetCapability("ensureCleanSession", true);
                _webdriver = new RemoteWebDriver(new Uri(ConfigurationManager.AppSettings["remotewebdriver_url"]), caps);
                //_webdriver.Manage().Window.Maximize();
                break;
            case Drivers.LocalStack:
                //
                // Start the local BrowserStack proxy for cloud browser access
                //
                bool bConnected = false;
                do {
                    //
                    // Reset the stdout capture
                    //
                    sbOutput = new StringBuilder();

                    //
                    // check if connection succeeeded
                    //
                    bConnected = LaunchBrowserStackLocalProcess();
                } while (!bConnected);

                _webdriver = new RemoteWebDriver(new Uri(ConfigurationManager.AppSettings["remotewebdriver_url"]), caps, TimeSpan.FromMinutes(5.0));
                break;
            }
            //
            // Set an implicit timeout for all FindElements
            //
            _webdriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(Factory.DefaultTimeoutValue));

            return _webdriver;
        }
开发者ID:buonan,项目名称:SeleniumTests,代码行数:68,代码来源:Factory.cs


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