本文整理汇总了C#中OpenQA.Selenium.Remote.RemoteWebDriver.FindElementsByCssSelector方法的典型用法代码示例。如果您正苦于以下问题:C# RemoteWebDriver.FindElementsByCssSelector方法的具体用法?C# RemoteWebDriver.FindElementsByCssSelector怎么用?C# RemoteWebDriver.FindElementsByCssSelector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenQA.Selenium.Remote.RemoteWebDriver
的用法示例。
在下文中一共展示了RemoteWebDriver.FindElementsByCssSelector方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldIncludeAtLeastOneLicense
public static void ShouldIncludeAtLeastOneLicense( RemoteWebDriver driver, AuthenticatingNavigator navigator )
{
using ( driver.FinallyQuitGuard() ) // TODO improve this using http://xunit.codeplex.com/workitem/9798 ( WAS: http://xunit.codeplex.com/discussions/362097 )
{
navigator.NavigateWithAuthenticate( driver, "license" );
// Even when cold, 5 seconds is a long time to wait
WebDriverWait wait = new WebDriverWait( driver, TimeSpan.FromSeconds( 5 ) );
wait.Until( d => driver.FindElementsByCssSelector( "#licenses tr" ).Count > 0 );
}
}
示例2: SetValueForChosenJQueryControlMulti
public static void SetValueForChosenJQueryControlMulti(
RemoteWebDriver browser,
string cssSelector, string value,
bool clearExisting = false)
{
var clickTarget = browser.FindElementByCssSelector(cssSelector);
clickTarget.Click();
if (clearExisting)
{
foreach (var removeButton in browser.FindElementsByCssSelector(cssSelector + " li .search-choice-close"))
{
removeButton.Click();
}
}
var selection =
browser.FindElementsByCssSelector(cssSelector + " li").FirstOrDefault(e => e.Text.Contains(value));
Assert.NotNull(selection);
selection.Click();
}
示例3: GetLicensedDomains
private static IEnumerable<string> GetLicensedDomains(RemoteWebDriver browser)
{
var licensedDomains = browser.FindElementsByCssSelector("a[href^='/DomainLicense/Edit']")
.Select(a => a.FindElement(By.XPath("./ancestor::tr/td[1]")).Text.Trim())
.ToArray();
return licensedDomains;
}
示例4: GetUnvisitedLinks
private static ConcurrentDictionary<Uri, Uri> GetUnvisitedLinks(RemoteWebDriver _driver, Uri parentUri, string DriverUri, ConcurrentDictionary<Uri, Uri> PartThreading, ConcurrentDictionary<Uri, Uri> pageToVist,Uri startUri)
{
var result = new List<Uri>();
var originHost = _options.StartUrl.Host;
var links = _driver.FindElementsByCssSelector("a[href],a[ng-href]")
.Select(a =>
{
try
{
if (a.GetAttribute("href") != null)
return new Uri(a.GetAttribute("href"));
else
return new Uri(a.GetAttribute("ng-href"));
}
catch (Exception ex)
{
return null;
}
}
);
foreach (var link in links)
{
if (link != null && link.AbsoluteUri.Contains(startUri.AbsoluteUri) && !pageVisitedURLMapping.ContainsKey(link)
&& !pageToVist.ContainsKey(link) && !PartThreading.ContainsKey(link) && !result.Contains(link))
{
result.Add(link );
}
}
foreach(var r in result)
{
pageToVist.TryAdd(r, parentUri);
}
logger.Info(" Thead : [{3}] Get [{0}] sameDomainUnvisitedLinks, Size :[{1}] should be the same , Current URL : [{2}]", result.Count, pageToVist.Count, parentUri ,startUri.PathAndQuery
);
return pageToVist;
}