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


C# InternetExplorerDriver.Dispose方法代碼示例

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


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

示例1: ShouldBeAbleToCallDisposeAfterQuit

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

示例2: ShouldBeAbleToStartNewDriverAfterCallingCloseOnOnlyOpenWindow

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

示例3: Test_for_donation_error_text

        public void Test_for_donation_error_text()
        {
            RemoteWebDriver Driver = new InternetExplorerDriver();
            Driver.Navigate().GoToUrl(@"http://en.wikipedia.org/");

            // On Main Page
            var lnkSupportUs = Driver.FindElementByCssSelector(@"a[title='Support us']");
            lnkSupportUs.Click();

            // On Make your donation page

            var radio50UAH = Driver.FindElementByCssSelector(@"#input_amount_0[value='50']");
            radio50UAH.Click();


            // And clich on "Donate" button
            var btnDonate = Driver.FindElementByCssSelector(@"input[value='Donate by credit/debit card']");
            btnDonate.Click();


            // On Billing information

            var txtFirstName = Driver.FindElementByName("fname");
            var txtLastName = Driver.FindElementByName("lname");
            var txtStreet = Driver.FindElementByName("street");
            var txtPostalCode = Driver.FindElementByName("zip");
            var txtCity = Driver.FindElementByName("city");
            var txtEmailAddress = Driver.FindElementByName("emailAdd");

            var radioCardType = Driver.FindElementByCssSelector(@"input[name='cardtype'][value='visa']");


            txtFirstName.Clear();
            txtFirstName.SendKeys("Vasya");

            txtLastName.Clear();
            txtLastName.SendKeys("Poopkin");

            txtCity.Clear();
            txtCity.SendKeys("Kyiv");

            txtEmailAddress.Clear();
            txtEmailAddress.SendKeys("[email protected]");

            txtPostalCode.Clear();
            txtPostalCode.SendKeys("80999");

            txtStreet.Clear();
            txtStreet.SendKeys("It is very boring");

            radioCardType.Click();


            // Donation form second part

            var wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(30));

            string frameSelector = @"div#payment > iframe";

            wait.Until(ExpectedConditions.ElementExists(By.CssSelector(frameSelector)));

            var frameFormSecondPart = Driver.FindElementByCssSelector(frameSelector);

            Driver.SwitchTo().Frame(frameFormSecondPart);

            string cardNumSelector = @"CREDITCARDNUMBER";
            wait.Until(ExpectedConditions.ElementIsVisible(By.Name(cardNumSelector)));

            var txtCreditCardNum = Driver.FindElementByName(cardNumSelector);
            var selectExpMonth = new SelectElement(Driver.FindElementByName(@"EXPIRYDATE_MM"));
            var selectExpYear = new SelectElement(Driver.FindElementByName(@"EXPIRYDATE_YY"));
            var txtCVV = Driver.FindElementByName(@"CVV");
            var btnSubmit = Driver.FindElementById(@"btnSubmit");

            txtCreditCardNum.Clear();
            txtCreditCardNum.SendKeys("4716699955349929");

            selectExpMonth.SelectByText("02");
            selectExpYear.SelectByText("15");

            txtCVV.Clear();
            txtCVV.SendKeys("555");

            // Looks like we cannot click on this button. 
            // Well... 
            btnSubmit.SendKeys(Keys.Enter);

            Driver.SwitchTo().DefaultContent();

            // On Donate result page

            wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(@"div#mw-content-text * big > span")));
            var lblTransactionErrorMessage = Driver.FindElement(By.CssSelector(@"div#mw-content-text * big > span"));

            Assert.AreEqual("Your transaction could not be accepted.", lblTransactionErrorMessage.Text);

            Driver.Dispose();

        }
開發者ID:qaleader,項目名稱:MyPresentations.Slides-n-Source,代碼行數:99,代碼來源:UnitTest1.cs

示例4: TestMethod1

        public void TestMethod1()
        {
            //RemoteWebDriver Driver = new InternetExplorerDriver();
            RemoteWebDriver Driver = new InternetExplorerDriver();
            //Driver.Url = "www.football.ua";
            Driver.Navigate().GoToUrl(@"http://en.wikipedia.org/");
            //Driver.Manage().Window.Maximize();

            var lnkSupportUs = Driver.FindElementByCssSelector(@"a[title = 'Support us']");
            lnkSupportUs.Click();

            // Cannot find with this locator!
            var radio50UAH = Driver.FindElementByXPath("/html/body/div[3]/div[2]/div[3]/table/tbody/tr/td[2]/form/div/div[3]/table/tbody/tr[1]/td[1]/label");//Driver.FindElementById("input_amount_0");// Driver.FindElementByCssSelector(@"#input_amount_0[value='50']");
            radio50UAH.Click();

            var btnDonate = Driver.FindElement(By.ClassName("payment-method-button"));
            btnDonate.Click();

            var txtFirstName = Driver.FindElementById("fname");
            var txtlastName = Driver.FindElementById("lname");
            var txtEmail = Driver.FindElementById("emailAdd");
            var radioCardType = Driver.FindElementById("cc-visa");

            txtFirstName.Clear();
            txtFirstName.SendKeys("Vasya");

            txtlastName.Clear();
            txtlastName.SendKeys("Poopkin");

            txtEmail.Clear();
            txtEmail.SendKeys("[email protected]");

            radioCardType.Click();

            var wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(6));

            var txtCreditCardNum = Driver.FindElementByName("CREDITCARDNU");
            var selectExpMonth = new SelectElement(Driver.FindElementById("F1010_MM"));
            var selectExpYear = new SelectElement(Driver.FindElementById("F1010_YY"));
            var txtCVV = Driver.FindElementById(@"F1136");
            var btnSubmit = Driver.FindElementById(@"btnSubmit");

            txtCreditCardNum.Clear();
            txtCreditCardNum.SendKeys("8975397698238467");

            selectExpMonth.SelectByText("02");
            selectExpYear.SelectByText("15");

            txtCVV.Clear();
            txtCVV.SendKeys("836");

            btnSubmit.SendKeys(Keys.Enter);

            Driver.SwitchTo().DefaultContent();

            // On Donate results page

            string headerSelector = @"h1.firstHeading";
            var headingElement = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(headerSelector)));

            Assert.AreEqual("Donate-error", headingElement.Text);

            Driver.Quit();
            Driver.Dispose();
        }
開發者ID:thebestsoftware,項目名稱:testsautomationpractice,代碼行數:65,代碼來源:UnitTest1.cs

示例5: 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


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