本文整理汇总了C#中IWebDriver.FirstOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# IWebDriver.FirstOrDefault方法的具体用法?C# IWebDriver.FirstOrDefault怎么用?C# IWebDriver.FirstOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWebDriver
的用法示例。
在下文中一共展示了IWebDriver.FirstOrDefault方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDeleteButton
internal static IWebElement GetDeleteButton(IWebDriver driver)
{
var elem = driver.FirstOrDefault(By.CssSelector("#DeleteMessages"));
if (elem == null || !elem.Displayed)
{
elem = driver.FirstOrDefault(By.CssSelector("[title^='Delete (Del)']"));
}
return elem;
}
示例2: GetForwardButton
public static IWebElement GetForwardButton(IWebDriver driver)
{
var elem = driver.FirstOrDefault(By.CssSelector("#Forward"));
if (elem == null || !elem.Displayed)
{
elem = driver.FirstOrDefault(By.CssSelector("[aria-label^='Forward (SHIFT-F)']"));
}
return elem;
}
示例3: GetReplyButton
internal static IWebElement GetReplyButton(IWebDriver driver)
{
var elem = driver.FirstOrDefault(By.CssSelector("#Reply"));
if (elem == null || !elem.Displayed)
{
elem = driver.FirstOrDefault(By.CssSelector("[aria-label^='Reply (R)']"));
}
return elem;
}
示例4: GetPreviewPane
public static IWebElement GetPreviewPane(IWebDriver driver)
{
try
{
return driver.FirstOrDefault(By.Id("ReadMessageScrollableSection"));
}
catch (Exception)
{
return driver.FirstOrDefault(By.CssSelector(".conductorContent > div > div > .scrollContainer"));
}
}
示例5: GetReplyMenuElement
public static IWebElement GetReplyMenuElement(IWebDriver driver)
{
var elem = driver.FirstOrDefault(By.CssSelector("[title='More reply commands']"));
if (elem == null || !elem.Displayed)
{
elem = driver.FirstOrDefault(By.CssSelector("[title='More ways to reply']"));
}
return elem;
}
示例6: GetMessageBodyElement
internal static IWebElement GetMessageBodyElement(IWebDriver driver)
{
var elem = driver.FirstOrDefault(By.CssSelector(".readMsgBody"));
if (elem == null || !elem.Displayed)
{
var msgBody = driver.FirstOrDefault(By.CssSelector("[aria-label^='Message Body']"));
if (msgBody != null)
{
elem = msgBody.FindParent();
}
}
return elem;
}
示例7: OpeningItem
public virtual void OpeningItem(IWebDriver wd, Logger logger)
{
var eventArgs = new DOMEventArgs(wd, logger);
OnOpeningItem(this, eventArgs);
if (eventArgs.ShouldCancelNavigation)
{
return;
}
var link = wd.FirstOrDefault(By.CssSelector(this.LocationCriteria));
if (link == null || !link.IsDisplayed())
{
logger.Info("Couldn't find Element to Engage Alternate Activity for: {0}", Key);
return;
}
link.Click();
}
示例8: GetUnblockContentElement
internal static IWebElement GetUnblockContentElement(IWebDriver driver)
{
var elem = driver.FirstOrDefault(By.XPath("//a[contains(text(), 'Show content')]"));
if (elem == null || !elem.Displayed)
{
elem = driver.FirstOrDefault(By.CssSelector("a > span"), e => e.Text.ToLower().Contains("show blocked content"));
}
return elem;
}
示例9: GetJunkFolderElement
public static IWebElement GetJunkFolderElement(IWebDriver driver)
{
var selectionLogic = new Func<IWebElement>[]
{
() => driver.FirstOrDefault(By.CssSelector("[title^='Junk Email']")),
() => driver.FirstOrDefault(By.CssSelector("[title^='Junk']"))
};
foreach (var f in selectionLogic)
{
try
{
var junk = f();
if (junk != null)
{
return junk;
}
}
catch (Exception) { }
}
return null;
}
示例10: GetInboxFolderElement
public static IWebElement GetInboxFolderElement(IWebDriver driver)
{
var selectionLogic = new Func<IWebElement>[]
{
() => driver.FirstOrDefault(By.CssSelector("[title^='Inbox']"))
};
foreach (var f in selectionLogic)
{
try
{
var inbox = f();
if (inbox != null)
{
return inbox;
}
}
catch (Exception) { }
}
return null;
}
示例11: GetShowBlockedElement
public static IWebElement GetShowBlockedElement(IWebDriver driver)
{
var elem = driver.FirstOrDefault(By.XPath("//a[contains(text(), 'Let me check')]"));
if (elem == null || !elem.Displayed)
{
elem = GetPreviewPane(driver).FirstOrDefault(By.CssSelector(".scrollContainer a > span"), e => e.Text.ToLower() == "show blocked content");
}
return elem;
}
示例12: GetUnJunkElement
public static IWebElement GetUnJunkElement(IWebDriver driver)
{
try
{
return driver.FirstOrDefault(By.ClassName("sfUnjunkItems"));
}
catch (Exception)
{
return GetPreviewPane(driver).FirstOrDefault(By.CssSelector(".scrollContainer a > span"), e => e.Text.ToLower() == "it's not spam");
}
}