示例#1
0
 /// <summary>
 /// Gets trimmed inner text of the main button.
 /// </summary>
 /// <returns></returns>
 public virtual string GetName()
 {
     return(WrappedElement
            .Children()
            .First()
            .TextHelper()
            .InnerText);
 }
 /// <summary>
 /// Returns all item container elements.
 /// </summary>
 /// <returns></returns>
 public virtual IReadOnlyList <IWebElement> GetItems()
 {
     return(WrappedElement
            .Children()
            .Where(e => !e.Classes().Contains("k-seperator"))
            .ToList()
            .AsReadOnly());
 }
        /// <summary>
        /// Returns a list of all dt-elements with their corresponding
        /// dd-elements.
        /// </summary>
        /// <returns></returns>
        public IReadOnlyList <(IWebElement term, IWebElement detail)> GetDescriptions()
        {
            var results  = new List <(IWebElement term, IWebElement detail)>();
            var children = WrappedElement.Children();

            //var currentGroup = Tuple.Create<IWebElement, IWebElement>(null, null);

            for (var i = 0; i < children.Count; i++)
            {
                var termEl    = children[i];
                var detailsEl = default(IWebElement);

                // Ignore if the element isn't dt.
                if (!HasTagName("dt", termEl))
                {
                    continue;
                }

                // Locate the next dd element.
                i++;
                for ( ; i < children.Count; i++)
                {
                    var el = children[i];

                    if (!HasTagName("dd", el))
                    {
                        continue;
                    }

                    detailsEl = el;
                    results.Add((termEl, detailsEl));
                    break;
                }
            }

            return(results);
        }