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


C# IWebDriver.Manage方法代码示例

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


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

示例1: InitializeWebDriver

		private static void InitializeWebDriver() {
			switch (Configuration.BrowserType) {
				case BrowserType.Firefox:
					WebDriver = new FirefoxDriver();
					break;
				case BrowserType.InternetExplorer:
					var ieOptions = new InternetExplorerOptions {
						EnableNativeEvents = true,
						EnablePersistentHover = true,
						EnsureCleanSession = true,
						UnexpectedAlertBehavior = InternetExplorerUnexpectedAlertBehavior.Dismiss
					};

					WebDriver = new InternetExplorerDriver("./", ieOptions);
					break;
				case BrowserType.Chrome:
					var chromeOptions = new ChromeOptions();
					chromeOptions.AddArguments("test-type");

					WebDriver = new ChromeDriver("./", chromeOptions);
					break;
				default:
					throw new ArgumentException("Unknown browser type is specified!");
			}

			WebDriver.Manage().Window.Maximize();
			WebDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(Configuration.ImplicitWaitTime));
		}
开发者ID:yizeng,项目名称:AutomateXeroRepeatingInvoicesTab,代码行数:28,代码来源:TestsBase.cs

示例2: ExecuteScript

        private static void ExecuteScript(IWebDriver wd)
        {
            try
            {
                //wd.Manage().Window.Maximize();
                //Console.WriteLine("Browser Maximizado");

                wd.Navigate().GoToUrl("http://www.minhaseconomias.com.br");
                Console.WriteLine("Acessado o Site Minhas Economias");
                wd.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
                wd.FindElement(By.ClassName("login")).Click();
                wd.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
                Console.WriteLine("Clicado no Botão de 'Entrar'");
                wd.FindElement(By.Id("email")).SendKeys("[email protected]");
                Console.WriteLine("Digitado o Login (E-mail)");
                wd.FindElement(By.Id("senha")).SendKeys("[email protected]");
                Console.WriteLine("Digitada a Senha");
                wd.FindElement(By.Id("login")).FindElement(By.Name("OK")).Click();
                Console.WriteLine("Clicado no botão 'Entrar'");
            }
            finally
            {
                wd.Close();
            }
        }
开发者ID:lucaslra,项目名称:Selenium,代码行数:25,代码来源:Program.cs

示例3: DocfxSeedSiteFixture

        public DocfxSeedSiteFixture()
        {
            JObject token = JObject.Parse(File.ReadAllText(ConfigFile));
            var folder = (string)token.SelectToken("site");
            var port = (int)token.SelectToken("port");

            Driver = new FirefoxDriver();
            Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
            Driver.Manage().Window.Maximize();

            try
            {
                var contentTypeProvider = new FileExtensionContentTypeProvider();
                // register yaml MIME as OWIN doesn't host it by default.
                // http://stackoverflow.com/questions/332129/yaml-mime-type
                contentTypeProvider.Mappings[".yml"] = "application/x-yaml";
                var fileServerOptions = new FileServerOptions
                {
                    EnableDirectoryBrowsing = true,
                    FileSystem = new PhysicalFileSystem(folder),
                    StaticFileOptions =
                    {
                        ContentTypeProvider = contentTypeProvider
                    }
                };
                Url = $"{RootUrl}:{port}";
                WebApp.Start(Url, builder => builder.UseFileServer(fileServerOptions));
            }
            catch (System.Reflection.TargetInvocationException)
            {
                Console.WriteLine($"Error serving \"{folder}\" on \"{Url}\", check if the port is already being in use.");
            }

        }
开发者ID:dotnet,项目名称:docfx,代码行数:34,代码来源:DocfxSeedSiteFixture.cs

示例4: InitDriver

        public void InitDriver()
        {
            if (!Directory.Exists(@"P:\LabsDeploymentItems")) throw new Exception(@"Unable to locate P:\LabsDeploymentItems");

            switch (Properties.Settings.Default.BROWSER)
            {
                case BrowserType.Chrome:
                    WebDriver = new ChromeDriver(driversLocation);
                    break;
                case BrowserType.Ie:
                    InternetExplorerOptions opts = new InternetExplorerOptions();
                    opts.EnsureCleanSession = true;
                    opts.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
                    WebDriver = new InternetExplorerDriver(driversLocation, opts);
                    break;
                case BrowserType.Firefox:
                    WebDriver = new FirefoxDriver();
                    break;
                default:
                    throw new ArgumentException("Invalid BROWSER Setting has been used");
            }

            WebDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(Properties.Settings.Default.IMPLICIT_WAIT_SECONDS));
            WebDriver.Manage().Window.Maximize();
        }
开发者ID:pjagga,项目名称:SeleniumMSTestVS2013,代码行数:25,代码来源:BrowserContext.cs

示例5: logout

 public static void logout(IWebDriver driver)
 {
     driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(0));
     System.Collections.ObjectModel.ReadOnlyCollection<IWebElement> e = driver.FindElements(By.LinkText("Logout"));
     if (e.Count > 0) e.First().Click();
     driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(Config.implicitTimeout));
 }
开发者ID:nicholaswilliambrown,项目名称:ProfilesRNS_Testing,代码行数:7,代码来源:Utilities.cs

示例6: TestInit

 public void TestInit()
 {
     _driver = new FirefoxDriver();
     _driver.Manage().Window.Maximize();
     _driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
     _driver.Navigate().GoToUrl(Facebook);
 }
开发者ID:AViktoriiaV,项目名称:TeamCity,代码行数:7,代码来源:UnitTest1.cs

示例7: HomepageTabsTickle

        public void HomepageTabsTickle(Datarow datarow, IWebDriver driver, string url)
        {
            try
            {
                driver.Navigate().GoToUrl(url);

                Thread.Sleep(0xbb8);
                driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10.0));
                driver.FindElement(By.XPath("//body[@id='page-home-index']/div/div[2]/div/ul/li/div/div/a/h2"));
                driver.FindElement(By.XPath("//body[@id='page-home-index']/div/div[2]/div/ul/li/div/div/a/h2")).Click();

                driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10.0));
                driver.FindElement(
                    By.XPath("//body[@id='page-categories-details']/div/div[2]/div/ul/li/div/div/a/h2"));
                driver.FindElement(By.XPath("//body[@id='page-categories-details']/div/div[2]/div/ul/li/div/div/a/h2"))
                      .Click();

                driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10.0));
                driver.FindElement(By.XPath("//body[@id='page-categories-details']/div/div[2]/div/ul/li/div/div/a/p"));
                driver.FindElement(By.XPath("//body[@id='page-categories-details']/div/div[2]/div/ul/li/div/div/a/p"))
                      .Click();
            }
            catch (Exception exception)
            {
                var actual = exception.ToString();
                datarow.Newrow("Exception", "Not Expected", actual, "FAIL", driver);
            }
        }
开发者ID:TejaVellanki,项目名称:PlatformAutomationTestFramework,代码行数:28,代码来源:Tickle.cs

示例8: DocfxSeedSiteFixture

        public DocfxSeedSiteFixture()
        {
            JObject token = JObject.Parse(File.ReadAllText(ConfigFile));
            var folder = (string)token.SelectToken("site");
            var port = (int)token.SelectToken("port");

            Driver = new FirefoxDriver();
            Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
            Driver.Manage().Window.Maximize();

            try
            {
                var fileServerOptions = new FileServerOptions
                {
                    EnableDirectoryBrowsing = true,
                    FileSystem = new PhysicalFileSystem(folder),
                };
                Url = $"{RootUrl}:{port}";
                WebApp.Start(Url, builder => builder.UseFileServer(fileServerOptions));
            }
            catch (System.Reflection.TargetInvocationException)
            {
                Console.WriteLine($"Error serving \"{folder}\" on \"{Url}\", check if the port is already being in use.");
            }

        }
开发者ID:yodamaster,项目名称:docfx,代码行数:26,代码来源:DocfxSeedSiteFixture.cs

示例9: StartupBase

 public void StartupBase()
 {
     driver = new FirefoxDriver();
     driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMilliseconds(Constants.MidleDelay));
     driver.Manage().Window.Maximize();
     Driver.SetDriver(driver);
 }
开发者ID:Savostytskyi,项目名称:C-_Login_Test,代码行数:7,代码来源:BaseTestSetUp.cs

示例10: Initialize

 public void Initialize()
 {
     _driver = new FirefoxDriver();
     _actions = new Actions(_driver);
     _driver.Url = "http://www.ramyamlab.com/";
     _driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
     _driver.Manage().Window.Maximize();
 }
开发者ID:SudeepthiM,项目名称:Ramyam,代码行数:8,代码来源:RamyamTests.cs

示例11: OptimizeDriver

 private static IWebDriver OptimizeDriver(IWebDriver driver)
 {
     driver.Manage().Window.Maximize();
     driver.Manage().Cookies.DeleteAllCookies();
     driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
     driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(30));
     return driver;
 }
开发者ID:blokhina1605,项目名称:CDP_C-,代码行数:8,代码来源:DriverManager.cs

示例12: SetUp

 public void SetUp()
 {
     _driver = DriverSetup.Driver;
     _driver.Manage().Window.Maximize();
     _driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
     _driver.Navigate().GoToUrl(TestConfiguration.ApplicationUrl);
     homePage = new HomePage(_driver);
 }
开发者ID:Varomir,项目名称:SearchCSharp,代码行数:8,代码来源:BaseTest.cs

示例13: TestBaseInitialize

 // Use method to initialize drivers
 // driver - Selenium webdriver
 // browser- Selenium webdriver wrapped with protractor - for angular files
 public static void TestBaseInitialize()
 {
     browser = new ChromeDriver(ConfigurationManager.AppSettings["ChromeDriverPath"]);
     driver = new NgWebDriver(browser);
     var timeout = Convert.ToInt32(ConfigurationManager.AppSettings["DriverScriptTimeout"], CultureInfo.InvariantCulture);
     driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(timeout));
     driver.Manage().Window.Maximize();
 }
开发者ID:Rajeshbharathi,项目名称:CGN.Paralegal,代码行数:11,代码来源:TestBase.cs

示例14: ClassInitialize

 public void ClassInitialize()
 {
     launcher.Start();
     driver = new FirefoxDriver();
     driver.Manage().Window.Maximize();
     driver.Manage().Cookies.DeleteAllCookies();
     driver.Navigate().GoToUrl("https://accounts.google.com/ServiceLogin?service=mail&continue=https://mail.google.com/mail/#identifier");
 }
开发者ID:nvega-ms,项目名称:SikuliDotNetExample,代码行数:8,代码来源:TestClass.cs

示例15: Initialize

        public static void Initialize()
        {
            baseUrl = "http://52Projects.dev.mymissionsapp.com";

            webDriver = new FirefoxDriver(new FirefoxBinary(@"C:\Program Files (x86)\Mozilla Firefox\Firefox.exe"), new FirefoxProfile(), TimeSpan.FromMinutes(defaultTimeout));
            //webDriver = new ChromeDriver();
            webDriver.Manage().Window.Maximize();
            webDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(defaultTimeout));
        }
开发者ID:dnamartin,项目名称:Automation,代码行数:9,代码来源:Browser.cs


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