当前位置: 首页>>代码示例>>C#>>正文


C# IWebElement.FindElements方法代码示例

本文整理汇总了C#中IWebElement.FindElements方法的典型用法代码示例。如果您正苦于以下问题:C# IWebElement.FindElements方法的具体用法?C# IWebElement.FindElements怎么用?C# IWebElement.FindElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IWebElement的用法示例。


在下文中一共展示了IWebElement.FindElements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFancySelectOptions

 public static KeyValuePair<string, IWebElement>[] GetFancySelectOptions(IWebElement fancyElement)
 {
     return fancyElement
         .FindElements(By.CssSelector("li > a"))
         .Select(x => new KeyValuePair<string, IWebElement>(x.GetAttribute("text"), x))
         .ToArray();
 }
开发者ID:MichalGrzegorzak,项目名称:Ylvis,代码行数:7,代码来源:WebElementHelper.cs

示例2: GetSelectOptions

 public static KeyValuePair<string, string>[] GetSelectOptions(IWebElement selectElement)
 {
     var options = selectElement.FindElements(By.TagName("option"));
     return options
         .Select(x => new KeyValuePair<string, string>(x.GetAttribute("value"), x.GetAttribute("text")))
         .ToArray();
 }
开发者ID:MichalGrzegorzak,项目名称:Ylvis,代码行数:7,代码来源:WebElementHelper.cs

示例3: GetDomainName

        protected override string GetDomainName(IWebElement el)
        {
            var result = string.Empty;

            Driver.RepeatFindAndExecuteAction
            (
                () =>
                {
                    var row = el.FindElements(DomainNameElementLocator).FirstOrDefault(x => x.IsDisplayed());
                    return row.FindElements(By.CssSelector("span")).FirstOrDefault(x=> x.IsDisplayed() && !String.IsNullOrWhiteSpace(x.GetAttribute("email")));
                },

                x =>
                {
                    var address = new MailAddress(x.GetAttribute(DomainNameAttributeName));
                    result = address.Host;
                },

                () => Delay(),

                WebDriverDefaults.NumberOfRetriesForStaleExceptions
            );

            return result;
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:25,代码来源:EmailEngager.cs

示例4: Table

        protected List<IWebElement> _tableRows; //List of all the rows to loop through to look for matches.

        #endregion Fields

        #region Constructors

        public Table(IWebElement table)
        {
            try
            {
                //Look for and assign the tbody element
                _tableBody = table.FindElement(By.TagName("tbody"));
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Couldn't find a tbody tag for this table. {0}", ex.Message));
            }

            try
            {
                //Look for all the table headers
                _tableHeaders = table.FindElements(By.TagName("th")).ToList();
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Couldn't find any th tags within this table. {0}", ex.Message));
            }

            try
            {
                //Look for all the table rows
                _tableRows = _tableBody.FindElements(By.TagName("tr")).ToList();
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("This table doesn't contain any rows. {0}", ex.Message));
            }
        }
开发者ID:FriendlyTester,项目名称:Table-ControlObject,代码行数:38,代码来源:TableControlObject.cs

示例5: WaitForAutocomplete

 public void WaitForAutocomplete(IWebElement el)
 {
     new WebDriverWait(driver, TimeSpan.FromSeconds(explTimeout)).Until<Boolean>(drv =>
     {
         return (el.Displayed && el.FindElements(By.CssSelector("li")).Count > 0);
     });
 }
开发者ID:jar11,项目名称:automation,代码行数:7,代码来源:WebPage.cs

示例6: ColumnCount

 public int ColumnCount(IWebElement element)
 {
     IList<IWebElement> tableRows = element.FindElements(By.CssSelector("tr"));
     IWebElement headerRow = tableRows[0];
     IList<IWebElement> tableCols = headerRow.FindElements(By.CssSelector("td"));
     return tableCols.Count();
 }
开发者ID:BrockFredin,项目名称:SeleniumLW,代码行数:7,代码来源:Table.cs

示例7: FindElementsWithTimeoutWait

        /// <summary>
        /// Finds the elements with timeout wait.
        /// </summary>
        /// <param name="currentElement">The current element.</param>
        /// <param name="by">The by.</param>
        /// <returns></returns>
        public static ReadOnlyCollection<IWebElement> FindElementsWithTimeoutWait(IWebElement currentElement, By by)
        {
            Exception ex = null;
            ReadOnlyCollection<IWebElement> e = null;
            long elapsedTime = 0;
            while (elapsedTime < TimeOut)
            {
                try
                {
                    elapsedTime++;
                    StandardSleep(1);
                    e = currentElement.FindElements(by);
                    break;
                }
                catch (NoSuchElementException nse)
                {
                    if (e == null)
                        throw ex;
                }
            }

            if (e == null)
                throw ex;

            return e;
        }
开发者ID:harindu61,项目名称:twitterTest,代码行数:32,代码来源:ThreadWait.cs

示例8: IsGoogleMapDisplayed

        private bool IsGoogleMapDisplayed(IWebElement containerElement)
        {
            var mapElements = containerElement
                .FindElements(By.CssSelector("div.gm-style"))
                .Where(x => x.Displayed);

            return mapElements.Count() > 0;
        }
开发者ID:MichalGrzegorzak,项目名称:Ylvis,代码行数:8,代码来源:BriOfficeOverviewPage.cs

示例9: FunctionsTableRow

 internal FunctionsTableRow(IWebElement rowElement)
     : base(rowElement, isHeaderRow: false)
 {
     if (!string.Equals(rowElement.GetAttribute("ng-repeat"), "entry in functionDefinitions.page") ||
         rowElement.FindElements(By.TagName(Tags.Td)).Count != 2)
     {
         throw new ArgumentException("The element is not a functions table data row", "rowElement");
     }
 }
开发者ID:farukc,项目名称:azure-webjobs-sdk-dashboard-tests,代码行数:9,代码来源:FunctionsTableRow.cs

示例10: GetGridHeaders

 private static IEnumerable<IWebElement> GetGridHeaders(IWebElement element, ByEx columnHeader)
 {
     var columnElements = element.FindElements(columnHeader);
     if (columnElements.ToList().Count == 0)
     {
         throw new InvalidCastException("WebElement is not a valid TableElement, no th or td tags in first tr.");
     }
     return columnElements;
 }
开发者ID:Duduosun,项目名称:SpecFlow.Extensions,代码行数:9,代码来源:GridElement.cs

示例11: FunctionArgumentsTableRow

 internal FunctionArgumentsTableRow(IWebElement rowElement)
     : base(rowElement, isHeaderRow: false)
 {
     if (!string.Equals(rowElement.GetAttribute("ng-repeat"), "param in model.parameters") ||
         rowElement.FindElements(By.TagName(Tags.Td)).Count != 3)
     {
         throw new ArgumentException("The element is not a function arguments table row", "rowElement");
     }
 }
开发者ID:farukc,项目名称:azure-webjobs-sdk-dashboard-tests,代码行数:9,代码来源:FunctionArgumentsTableRow.cs

示例12: clearStarsField

        public void clearStarsField(IWebElement webElement)
        {
            ReadOnlyCollection<IWebElement> elements = webElement.FindElements(By.XPath(".//div[contains(@class,'b-control-ratings-star')]"));
            if (getStarsField(webElement) != 1)
            {
                elements[0].Click();
            }

            elements[0].Click();
        }
开发者ID:a-mironov-parc,项目名称:KTAutotests,代码行数:10,代码来源:Page.cs

示例13: GetElements

        private static IWebElement GetElements(IWebElement driver, string query, int index)
        {
            var elements = driver.FindElements(By.XPath(query));
            if (!elements.Any())
            {
                throw new Exception(string.Format("No elements returned with query {0} looking for index {1}", query, index));
            }

            return elements[index];
        }
开发者ID:marcoippel,项目名称:Seleniumtest.ScreenCapture.Provider,代码行数:10,代码来源:SeleniumHelper.cs

示例14: TransformWebListToCSharpList

 public static List<jcElementWrapper> TransformWebListToCSharpList(IWebElement theList)
 {
     var returnList = new List<jcElementWrapper>();
     var elements = theList.FindElements(By.CssSelector("li"));
     foreach (var el in elements)
     {
         returnList.Add(new jcElementWrapper(el));
     }
     return returnList;
 }
开发者ID:rohanbaraskar,项目名称:C-Sharp-GUI-Web-Framework,代码行数:10,代码来源:jcElementHelper.cs

示例15: HeadingsDownSideTable

        public HeadingsDownSideTable(IWebElement table)
        {
            var trs = table.FindElements(By.TagName("tr"));
            Assert.That(trs.Any(), "Table seems to be empty. " + table.Text);

            this.Rows = trs.Select(row => new Row
            {
                Heading = row.FindElement(By.TagName("th")),
                Cells = row.FindElements(By.TagName("td")).ToList()

            }).ToList();
        }
开发者ID:chriscore,项目名称:SpecDriver,代码行数:12,代码来源:HeadingsDownSideTable.cs


注:本文中的IWebElement.FindElements方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。