當前位置: 首頁>>代碼示例>>C#>>正文


C# InternetExplorerDriver.Close方法代碼示例

本文整理匯總了C#中OpenQA.Selenium.IE.InternetExplorerDriver.Close方法的典型用法代碼示例。如果您正苦於以下問題:C# InternetExplorerDriver.Close方法的具體用法?C# InternetExplorerDriver.Close怎麽用?C# InternetExplorerDriver.Close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenQA.Selenium.IE.InternetExplorerDriver的用法示例。


在下文中一共展示了InternetExplorerDriver.Close方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Main

        static void Main(string[] args)
        {
            //Create an instance of HTTPWatch Controller
            Controller control = new Controller();

            //Start IE Driver. IE Driver Server is located in C:\\
            IWebDriver driver = new InternetExplorerDriver(@"C:\");

            // Set a unique initial page title so that HttpWatch can attach to it
            string uniqueTitle = Guid.NewGuid().ToString();
            IJavaScriptExecutor js = driver as IJavaScriptExecutor;
            js.ExecuteScript("document.title = '" + uniqueTitle + "';");

            // Attach HttpWatch to the instance of Internet Explorer created through WebDriver
            Plugin plugin = control.AttachByTitle(uniqueTitle);

            //Open the HTTPWatch Window
            plugin.OpenWindow(false);

            //Navigate to the BMI Application Page
            driver.Navigate().GoToUrl("http://dl.dropbox.com/u/55228056/bmicalculator.html");

            //Perform some steps
            driver.FindElement(By.Id("heightCMS")).SendKeys("181");
            driver.FindElement(By.Id("weightKg")).SendKeys("80");
            driver.FindElement(By.Id("Calculate")).Click();

            //Export the HAR Log generated to a file
            plugin.Log.Save(@"C:\bmicalc.hwl");

            //Close the Internet Explorer
            driver.Close();
        }
開發者ID:vikramuk,項目名稱:Selenium,代碼行數:33,代碼來源:Program.cs

示例2: when_logging_in_with_an_invalid_username_and_password

        public void when_logging_in_with_an_invalid_username_and_password()
        {
            var capabilities = new DesiredCapabilities();
            capabilities.SetCapability(InternetExplorerDriver.IntroduceInstabilityByIgnoringProtectedModeSettings, true);

            var driver = new InternetExplorerDriver(capabilities);

            try
            {
                driver.Navigate().GoToUrl("http://localhost:52125/Account/LogOn");

                driver.FindElement(By.Name("UserName")).SendKeys("[email protected]");
                driver.FindElement(By.Name("Password")).SendKeys("BadPass");
                driver.FindElement(By.TagName("form")).Submit();

                driver.Url.ShouldEqual("http://localhost:52125/Account/LogOn");

                driver.FindElement(By.ClassName("validation-summary-errors")).Text.ShouldContain(
                    "The user name or password provided is incorrect.");
            }
            finally
            {
                driver.Close();
            }
        }
開發者ID:rajeshpillai,項目名稱:SpecsFor,代碼行數:25,代碼來源:LoginSpecsWithoutSpecsForMvc.cs

示例3: Main

 static void Main(string[] args)
 {
     try
     {
         var stopWatch = Stopwatch.StartNew();
         DesiredCapabilities capabilities = new DesiredCapabilities();
         var driverService = ChromeDriverService.CreateDefaultService(@"E:\");
         driverService.HideCommandPromptWindow = true;
         var webDriver = new InternetExplorerDriver();
         webDriver.Navigate().GoToUrl("http://www.udebug.com/UVa/10812");
         IWebElement inputBox = webDriver.FindElement(By.Id("edit-input-data"));
         inputBox.SendKeys("3\n2035415231 1462621774\n1545574401 1640829072\n2057229440 1467906174");
         IWebElement submitButton = webDriver.FindElement(By.Id("edit-output"));
         submitButton.SendKeys("\n");
         submitButton.Click();
         string answer = webDriver.PageSource;
         int begin = answer.IndexOf("<pre>") + 5;
         answer = answer.Substring(begin, answer.IndexOf("</pre>") - begin);
         Console.WriteLine(answer);
         webDriver.Close();
         Console.WriteLine(stopWatch.ElapsedMilliseconds);
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception.Message);
     }
 }
開發者ID:HuyTranQ,項目名稱:UvaLocalJudge,代碼行數:27,代碼來源:Program.cs

示例4: logging_in_with_invalid_credentials

        public void logging_in_with_invalid_credentials()
        {
            var capabilities = new DesiredCapabilities();
            capabilities.SetCapability(InternetExplorerDriver.IntroduceInstabilityByIgnoringProtectedModeSettings, true);

            var driver = new InternetExplorerDriver(capabilities);
            driver.Navigate().GoToUrl(TargetAppUrl + "/Authentication/LogOff");

            try
            {
                driver.Navigate().GoToUrl(TargetAppUrl + "/LogOn");

                driver.FindElement(By.Name("EmailAddress")).SendKeys("[email protected]");
                driver.FindElement(By.Name("Password")).SendKeys("BadPass");
                driver.FindElement(By.TagName("form")).Submit();

                driver.Url.ShouldEqual(TargetAppUrl + "/LogOn");

                driver.FindElement(By.ClassName("validation-summary-errors")).Text.ShouldContain(
                    "The user name or password provided is incorrect.");
            }
            finally
            {
                driver.Close();
            }
        }
開發者ID:williamflock,項目名稱:Fail-Tracker,代碼行數:26,代碼來源:AuthenticationSpecs.cs

示例5: ShouldBeAbleToCallQuitAfterCallingCloseOnOnlyOpenWindow

 public void ShouldBeAbleToCallQuitAfterCallingCloseOnOnlyOpenWindow()
 {
     EnvironmentManager.Instance.CloseCurrentDriver();
     IWebDriver testDriver = new InternetExplorerDriver();
     testDriver.Url = simpleTestPage;
     testDriver.Close();
     testDriver.Quit();
     testDriver = new InternetExplorerDriver();
     testDriver.Url = xhtmlTestPage;
     Assert.AreEqual("XHTML Test Page", testDriver.Title);
     testDriver.Quit();
 }
開發者ID:Goldcap,項目名稱:Constellation,代碼行數:12,代碼來源:DriverDisposalTests.cs

示例6: ShouldNotBeAbleToCallDriverMethodAfterCallingCloseOnOnlyOpenWindow

 public void ShouldNotBeAbleToCallDriverMethodAfterCallingCloseOnOnlyOpenWindow()
 {
     EnvironmentManager.Instance.CloseCurrentDriver();
     IWebDriver testDriver = new InternetExplorerDriver();
     try
     {
         testDriver.Url = simpleTestPage;
         testDriver.Close();
         string url = testDriver.Url;
         // Should never reach this line.
         Assert.AreEqual(string.Empty, url);
     }
     catch (WebDriverException)
     {
     }
     finally
     {
         testDriver.Dispose();
     }
 }
開發者ID:Goldcap,項目名稱:Constellation,代碼行數:20,代碼來源:DriverDisposalTests.cs

示例7: when_logging_in_with_a_valid_username_and_password

		public void when_logging_in_with_a_valid_username_and_password()
		{
			var options = new InternetExplorerOptions { IntroduceInstabilityByIgnoringProtectedModeSettings = true };
			var driver = new InternetExplorerDriver(options);

			try
			{
				driver.Navigate().GoToUrl("http://localhost:52125/Account/LogOn");

				driver.FindElement(By.Name("UserName")).SendKeys("[email protected]");
				driver.FindElement(By.Name("Password")).SendKeys("RealPassword");
				driver.FindElement(By.TagName("form")).Submit();

				driver.Url.ShouldEqual("http://localhost:52125/");
			}
			finally
			{
				driver.Close();
			}
		}
開發者ID:robertsimmons,項目名稱:SpecsFor,代碼行數:20,代碼來源:LoginSpecsWithoutSpecsForMvc.cs

示例8: logging_in_with_no_credentials_displays_validation_error

        public void logging_in_with_no_credentials_displays_validation_error()
        {
            var capabilities = new DesiredCapabilities();
            capabilities.SetCapability(InternetExplorerDriver.IntroduceInstabilityByIgnoringProtectedModeSettings, true);

            var driver = new InternetExplorerDriver(capabilities);
            driver.Navigate().GoToUrl(TargetAppUrl + "/Authentication/LogOff");

            try
            {
                driver.Navigate().GoToUrl(TargetAppUrl + "/LogOn");

                driver.FindElement(By.TagName("form")).Submit();

                driver.Url.ShouldEqual(TargetAppUrl + "/LogOn");

                driver.FindElements(By.CssSelector("span.field-validation-error[data-valmsg-for=\"EmailAddress\"]")).ShouldNotBeEmpty();
                driver.FindElements(By.CssSelector("span.field-validation-error[data-valmsg-for=\"Password\"]")).ShouldNotBeEmpty();
            }
            finally
            {
                driver.Close();
            }
        }
開發者ID:williamflock,項目名稱:Fail-Tracker,代碼行數:24,代碼來源:AuthenticationSpecs.cs

示例9: logging_in_with_valid_credentials_redirects_to_the_dashboard

        public void logging_in_with_valid_credentials_redirects_to_the_dashboard()
        {
            var capabilities = new DesiredCapabilities();
            capabilities.SetCapability(InternetExplorerDriver.IntroduceInstabilityByIgnoringProtectedModeSettings, true);

            var driver = new InternetExplorerDriver(capabilities);
            driver.Navigate().GoToUrl(TargetAppUrl + "/Authentication/LogOff");

            try
            {
                driver.Navigate().GoToUrl(TargetAppUrl + "/LogOn");

                driver.FindElement(By.Name("EmailAddress")).SendKeys("[email protected]");
                driver.FindElement(By.Name("Password")).SendKeys("TestPassword01");
                driver.FindElement(By.TagName("form")).Submit();

                driver.Url.ShouldEqual(TargetAppUrl + "/");
            }
            finally
            {
                driver.Close();
            }
        }
開發者ID:williamflock,項目名稱:Fail-Tracker,代碼行數:23,代碼來源:AuthenticationSpecs.cs

示例10: unauthorized_user_cannot_access_dashboard

        public void unauthorized_user_cannot_access_dashboard()
        {
            var capabilities = new DesiredCapabilities();
            capabilities.SetCapability(InternetExplorerDriver.IntroduceInstabilityByIgnoringProtectedModeSettings, true);

            var driver = new InternetExplorerDriver(capabilities);
            driver.Navigate().GoToUrl(TargetAppUrl + "/Authentication/LogOff");

            try
            {
                driver.Navigate().GoToUrl(TargetAppUrl + "/Dashboard");

                driver.Url.ShouldEqual(TargetAppUrl + "/LogOn?ReturnUrl=%2fDashboard");
            }
            finally
            {
                driver.Close();
            }
        }
開發者ID:williamflock,項目名稱:Fail-Tracker,代碼行數:19,代碼來源:AuthenticationSpecs.cs


注:本文中的OpenQA.Selenium.IE.InternetExplorerDriver.Close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。