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


C# FirefoxDriver.FindElementByCssSelector方法代碼示例

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


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

示例1: DoesPageExist

 public static bool DoesPageExist(FirefoxDriver driver, string pageName)
 {
     GotoPage(driver, pageName);
     bool exists = false;
     try
     {
         IWebElement pageTitle = null;
         PerformActionWithRetry(() => { pageTitle = driver.FindElementById("title-text"); });
         // Space Tools is the page to recover a deleted page.
         exists = pageTitle.Text != "Page Not Found" && pageTitle.Text != "Space Tools";
         if (exists)
         {
             // in case the page is in another space.
             // confluence shows the title with the correct page name
             // but the page does not exist.
             exists = driver.FindElementByCssSelector("div#content div.aui-message p.title").Text != "Page Not Found";
         }
     }
     catch
     {
         // ignored
     }
     return exists;
 }
開發者ID:EbenZhang,項目名稱:ConfluenceImporter,代碼行數:24,代碼來源:MainWindow.xaml.cs

示例2: EnterDummyPaymentOptions

        private void EnterDummyPaymentOptions(FirefoxDriver seleniumInstance,StripeCardDetails cardDetails)
        {
            seleniumInstance.SwitchTo().Frame(seleniumInstance.FindElementByCssSelector(".stripe_checkout_app"));
            var emailEl = seleniumInstance.FindElementByName("email");
            emailEl.SendKeys("[email protected]");
            var cardEl = seleniumInstance.FindElementByName("card_number");
            cardEl.SendKeys(cardDetails.CardNumber);
            var expiresEl = seleniumInstance.FindElementByName("cc-exp");
            expiresEl.SendKeys(cardDetails.Expiry);
            //var nameOnCard = seleniumInstance.FindElementById("paymentName");
            //nameOnCard.SendKeys(cardDetails.CardHolderName);
            var cvc = seleniumInstance.FindElementByName("cc-csc");
            cvc.SendKeys(cardDetails.CVC);

            var submitButton = seleniumInstance.FindElementByCssSelector(".button button");
            submitButton.ClickWithJavascript(seleniumInstance);
        }
開發者ID:tomgallard,項目名稱:pwinty-dotnet,代碼行數:17,代碼來源:PaymentTest.cs


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