當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。