當前位置: 首頁>>代碼示例>>C#>>正文


C# RemoteWebDriver.FindElementsByCssSelector方法代碼示例

本文整理匯總了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 );
			}
		}
開發者ID:InishTech,項目名稱:Sp.Api,代碼行數:11,代碼來源:LicenseList.cs

示例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();
        }
開發者ID:Natsui31,項目名稱:keyhub,代碼行數:24,代碼來源:SiteUtil.cs

示例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;
        }
開發者ID:Natsui31,項目名稱:keyhub,代碼行數:8,代碼來源:VendorRequirements.cs

示例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;

        }
開發者ID:Asing1001,項目名稱:Seo.Crawler.Service,代碼行數:43,代碼來源:Crawler.cs


注:本文中的OpenQA.Selenium.Remote.RemoteWebDriver.FindElementsByCssSelector方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。