public FindElementsByCssSelector ( string cssSelector ) : ReadOnlyCollection |
||
cssSelector | string | The CSS selector to match. |
Результат | ReadOnlyCollection |
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 ); } }
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(); }
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; }
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; }