本文整理汇总了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);
}