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


C# ChromeOptions.AddArgument方法代码示例

本文整理汇总了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);
 }
开发者ID:ehelin,项目名称:TgimbaSeleniumTests,代码行数:7,代码来源:DesktopHappyPath.cs

示例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);
            }
        }
开发者ID:XelGar256,项目名称:Scrap,代码行数:38,代码来源:GrindaModel.cs

示例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 { }
            }
        }
开发者ID:XelGar256,项目名称:Scrap,代码行数:60,代码来源:InboxModel.cs

示例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();
            }
        }
开发者ID:dawson-freddie30,项目名称:binginator,代码行数:30,代码来源:MainModel.cs

示例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));
        }
开发者ID:gkalnytskyi,项目名称:JiraAutomation,代码行数:11,代码来源:AutomationFramework.cs

示例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;
        }
开发者ID:NaseUkolyCZ,项目名称:roadkill,代码行数:11,代码来源:AcceptanceTestsSetup.cs

示例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;
        }
开发者ID:riganti,项目名称:selenium-utils,代码行数:13,代码来源:DefaultChromeWebDriverFactory.cs

示例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();
 }
开发者ID:Lampart071,项目名称:FirstTestSolved,代码行数:15,代码来源:GoogleTests.cs

示例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);
 }
开发者ID:Lampart071,项目名称:FirstTestSolved,代码行数:15,代码来源:SliderPageTests.cs

示例10: Start

        public void Start()
        {
            var options = new ChromeOptions();
              options.AddArgument("--test-type");

              Instance = new RemoteWebDriver(ChromeDriver.BaseUrl, options.ToCapabilities());
        }
开发者ID:agross,项目名称:mspec-samples,代码行数:7,代码来源:Browser.cs

示例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;
		}
开发者ID:rrsc,项目名称:Dnn.Platform,代码行数:35,代码来源:TestBase.cs

示例12: GetChromeOptions

 private static ChromeOptions GetChromeOptions()
 {
     ChromeOptions option = new ChromeOptions();
     option.AddArgument("start-maximized");
     option.Proxy = null;
     return option;
 }
开发者ID:rohanbaraskar,项目名称:SummerOutreachWebdriver,代码行数:7,代码来源:InitializeWebDriver.cs

示例13: CreateDriver

 public static IWebDriver CreateDriver()
 {
     ChromeOptions options = new ChromeOptions();
     options.AddArgument("--disable-cache");
     var driver = new ChromeDriver(options);
     return driver;
 }
开发者ID:FaisalZ,项目名称:FiVES,代码行数:7,代码来源:Tools.cs

示例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");
 }
开发者ID:cariarer,项目名称:TestStack.Seleno,代码行数:13,代码来源:BrowserFactory.cs

示例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;
        }
开发者ID:Saltorel,项目名称:BDD-CSharp,代码行数:8,代码来源:BaseClass.cs


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