本文整理汇总了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;
}