本文整理汇总了C#中OpenQA.Selenium.Chrome.ChromeOptions.AddArgument方法的典型用法代码示例。如果您正苦于以下问题:C# ChromeOptions.AddArgument方法的具体用法?C# ChromeOptions.AddArgument怎么用?C# ChromeOptions.AddArgument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenQA.Selenium.Chrome.ChromeOptions
的用法示例。
在下文中一共展示了ChromeOptions.AddArgument方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestHappyPathChrome
public void TestHappyPathChrome()
{
ChromeOptions co = new ChromeOptions();
co.AddArgument("--test-type");
ChromeDriver cd = new ChromeDriver("C:\\Users\\ehelin\\Downloads\\chromedriver_win32", co);
TestHappyPath(cd);
}
示例2: GrindaModel
public GrindaModel(string username, string password, BackgroundWorker bw, bool openGrinda)
{
string numbers = "";
ChromeDriverService service = ChromeDriverService.CreateDefaultService(App.Folder);
service.HideCommandPromptWindow = true;
ChromeOptions options = new ChromeOptions();
options.AddArgument("start-maximized");
options.AddArgument("user-data-dir=" + App.Folder + "profileGB");
IWebDriver driver = new ChromeDriver(service, options);
driver.Navigate().GoToUrl("http://www.grindabuck.com/login");
try
{
driver.FindElement(By.Id("login_username")).SendKeys(username);
driver.FindElement(By.Id("pwd")).SendKeys(password);
driver.FindElement(By.ClassName("btn-lg")).Click();
}
catch { }
IList<IWebElement> smalls = driver.FindElements(By.TagName("small"));
foreach (IWebElement small in smalls)
{
if (small.Text.Contains("Last Checkin"))
{
numbers = small.Text;
break;
}
}
if (DateTime.Parse(numbers.Split(' ')[2]).DayOfYear != DateTime.Now.DayOfYear)
{
checkIn(driver);
}
}
示例3: InboxModel
public InboxModel(string username, string password, BackgroundWorker bw, bool tv)
{
ChromeDriverService service = ChromeDriverService.CreateDefaultService(App.Folder);
service.HideCommandPromptWindow = true;
ChromeOptions options = new ChromeOptions();
options.AddArgument("start-maximized");
options.AddArgument("user-data-dir=" + App.Folder + "profileIB");
IWebDriver driver = new ChromeDriver(service, options);
driver.Navigate().GoToUrl("http://www.inboxdollars.com");
try
{
driver.FindElement(By.Id("loginname")).Clear();
driver.FindElement(By.Id("pwd")).Clear();
driver.FindElement(By.Id("loginname")).SendKeys(username);
driver.FindElement(By.Id("pwd")).SendKeys(password);
Helpers.wait(1000);
driver.FindElement(By.ClassName("submit2")).Click();
}
catch { }
try
{
if (driver.FindElement(By.Id("emailsBlock")).FindElement(By.ClassName("textBox")).Text != "0")
{
driver.FindElement(By.Id("emailsBlock")).FindElement(By.ClassName("textBox")).Click();
}
}
catch { }
if (!tv)
{
try
{
driver.FindElement(By.ClassName("videos")).Click();
videos(driver);
}
catch { }
}
else if (tv)
{
try
{
driver.FindElement(By.ClassName("tv")).Click();
Helpers.wait(2000);
Helpers.ByClass(driver, "jw-icon");
while (true)
{
try
{
driver.FindElement(By.Id("tvStillTherePopupContinue")).Click();
}
catch { }
}
}
catch { }
}
}
示例4: Launch
internal void Launch(bool mobile, string url = "https://www.bing.com/") {
Quit();
_viewModel.ResetProfileCommand.RaiseCanExecuteChanged();
ChromeDriverService service = ChromeDriverService.CreateDefaultService(App.Folder);
service.HideCommandPromptWindow = true;
ChromeOptions options = new ChromeOptions();
options.AddArgument("start-maximized");
options.AddArgument("user-data-dir=" + App.Folder + "profile");
if (mobile)
options.EnableMobileEmulation("Google Nexus 5");
try {
_driver = new ChromeDriver(service, options);
_driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(3));
_builder = new Actions(_driver);
LogUpdate("Launching Chrome " + (mobile ? "Mobile" : "Desktop"), Colors.CadetBlue);
if (url != null)
_driver.Navigate().GoToUrl(url);
}
catch (Exception ex) {
LogUpdate("Error Launching Chrome " + (mobile ? "Mobile" : "Desktop") + "\r\n" + ex.Message, Colors.Red);
service.Dispose();
}
}
示例5: Init
private void Init()
{
StopAllDrivers();
var options = new ChromeOptions();
var profilePath = ConfigurationManager.AppSettings["ProfilePath"];
options.AddArgument("--start-maximized");
options.AddArgument("--user-data-dir=" + profilePath);
Driver = new ChromeDriver(options);
Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(Timeout));
}
示例6: LaunchChrome
private ChromeDriver LaunchChrome()
{
// Disable the remember password popups, and make sure it's full screen so that Bootstrap elements aren't hidden
ChromeOptions options = new ChromeOptions();
options.AddArgument("--incognito");
options.AddArgument("--start-maximized");
ChromeDriver chromeDriver = new ChromeDriver(options);
chromeDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(2));
return chromeDriver;
}
示例7: CreateNewInstance
public IWebDriver CreateNewInstance()
{
var options = new ChromeOptions();
options.AddArgument("test-type");
if (SeleniumTestsConfiguration.ChromeDriverIncognito)
{
options.AddArgument("--disable-extensions");
}
var driver = new ChromeDriverWrapper(options);
driver.SetDefaultTimeouts();
return driver;
}
示例8: TestThatGoogleFindsJavaNotCsharp
public void TestThatGoogleFindsJavaNotCsharp()
{
ChromeOptions options = new ChromeOptions();
options.AddArgument("--no-sandbox");
options.AddArgument("--disable-extensions");
options.AddArgument("--start-maximized");
IWebDriver driver = new ChromeDriver(options);
driver.Navigate().GoToUrl("http://google.com");
driver.FindElement(By.Id("lst-ib")).SendKeys("Java");
driver.FindElement(By.Name("btnK")).Submit();
Thread.Sleep(1000);
Assert.IsTrue(driver.FindElement(By.CssSelector("#rso > div > div:nth-child(1) > div > h3 > a")).Text.Contains("Java"));
Assert.IsFalse(driver.FindElement(By.CssSelector("#rso > div > div:nth-child(1) > div > h3 > a")).Text.Contains("C#"));
driver.Close();
}
示例9: Login
public void Login()
{
ChromeOptions options = new ChromeOptions();
options.AddArgument("--no-sandbox");
options.AddArgument("--disable-extensions");
options.AddArgument("--start-maximized");
driver = new ChromeDriver(options);
driver.Navigate().GoToUrl("http://www.qa.way2automation.com");
driver.FindElement(By.CssSelector("#load_form > h3"));
driver.FindElement(By.CssSelector("#load_form > div > div.span_3_of_4 > p > a[href='#login']")).Click();
driver.FindElement(By.CssSelector("#load_form > fieldset:nth-child(5) > input[name='username']")).SendKeys("j2bwebdriver");
driver.FindElement(By.CssSelector("#load_form > fieldset:nth-child(6) > input[name='password']")).SendKeys("j2bwebdriver");
driver.FindElements(By.CssSelector("#load_form > div > div.span_1_of_4 > input"))[1].Submit();
Thread.Sleep(1000);
}
示例10: Start
public void Start()
{
var options = new ChromeOptions();
options.AddArgument("--test-type");
Instance = new RemoteWebDriver(ChromeDriver.BaseUrl, options.ToCapabilities());
}
示例11: StartDriver
public static IWebDriver StartDriver (string browserType)
{
Trace.WriteLine("Start browser: '" + browserType + "'");
IWebDriver driver = null;
switch (browserType)
{
case "ie":
{
driver = new InternetExplorerDriver("Drivers");
break;
}
case "firefox":
{
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.EnableNativeEvents = true;
firefoxProfile.AcceptUntrustedCertificates = true;
driver = new FirefoxDriver(firefoxProfile);
break;
}
case "chrome":
{
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddArgument("--disable-keep-alive");
driver = new ChromeDriver("Drivers", chromeOptions);
break;
}
}
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(3));
driver.Manage().Window.Maximize();
return driver;
}
示例12: GetChromeOptions
private static ChromeOptions GetChromeOptions()
{
ChromeOptions option = new ChromeOptions();
option.AddArgument("start-maximized");
option.Proxy = null;
return option;
}
示例13: CreateDriver
public static IWebDriver CreateDriver()
{
ChromeOptions options = new ChromeOptions();
options.AddArgument("--disable-cache");
var driver = new ChromeDriver(options);
return driver;
}
示例14: Chrome
/// <summary>
/// Returns an initialised Chrome Web Driver.
/// </summary>
/// <remarks>You need to have chromedriver.exe embedded into your assembly and have Chrome installed on the machine running the test</remarks>
/// <returns>Initialised Chrome driver</returns>
public static ChromeDriver Chrome()
{
var options = new ChromeOptions();
// addresses issue: https://code.google.com/p/chromedriver/issues/detail?id=799
options.AddArgument("test-type");
return new WebDriverBuilder<ChromeDriver>(() => new ChromeDriver(options))
.WithFileName("chromedriver.exe");
}
示例15: GetChromeOptions
private static ChromeOptions GetChromeOptions()
{
ChromeOptions option = new ChromeOptions();
option.AddArgument("start-maximized");
// option.AddExtension(@"C:\Users\rahul.rathore\Desktop\Cucumber\extension_3_0_12.crx");
return option;
}