本文整理匯總了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;
}
示例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);
}