Пример #1
0
        /// <summary>
        /// Finds te first row that matches <paramref name="comparer"/> in <paramref name="inColumn"/>
        /// defined as a TD html element. If no match is found, <c>null</c> is returned. This method will look for rows in all
        /// <see cref="Core.TableBody"/> elements but will ignore rows in nested tables.
        /// </summary>
        /// <param name="comparer">The comparer that the cell text must match.</param>
        /// <param name="inColumn">Index of the column to find the text in.</param>
        /// <returns>The searched for <see cref="TableRow"/>; otherwise <c>null</c>.</returns>
        public TableRow FindRowInDirectChildren(ICompare comparer, int inColumn)
        {
            Logger.LogAction("Matching comparer'" + comparer + "' with text in column " + inColumn + " of " + GetType().Name + " '" + Id + "'");

            TableRowAttributeConstraint constraint = new TableRowAttributeConstraint(comparer, inColumn);

            return(FindRowInDirectChildren(constraint));
        }
Пример #2
0
        /// <summary>
        /// Finds te first row that matches <paramref name="findTextRegex"/> in <paramref name="inColumn"/>
        /// defined as a TD html element. If no match is found, <c>null</c> is returned. This method will look for rows in all
        /// <see cref="Core.TableBody"/> elements but will ignore rows in nested tables.
        /// </summary>
        /// <param name="findTextRegex">The regular expression the cell text must match.</param>
        /// <param name="inColumn">Index of the column to find the text in.</param>
        /// <returns>The searched for <see cref="TableRow"/>; otherwise <c>null</c>.</returns>
        public TableRow FindRowInDirectChildren(Regex findTextRegex, int inColumn)
        {
            Logger.LogAction("Matching regular expression'" + findTextRegex + "' with text in column " + inColumn + " of " + GetType().Name + " '" + Id + "'");

            TableRowAttributeConstraint constraint = new TableRowAttributeConstraint(findTextRegex, inColumn);

            return(FindRowInDirectChildren(constraint));
        }
Пример #3
0
        /// <summary>
        /// Finds the first row that meets the <see cref="TableRowAttributeConstraint"/>.
        /// If no match is found, <c>null</c> is returned.
        /// </summary>
        /// <param name="findBy">The constraint used to identify the table cell.</param>
        /// <returns>The searched for <see cref="TableRow"/>; otherwise <c>null</c>.</returns>
        public TableRow FindRow(TableRowAttributeConstraint findBy)
        {
            TableRow row = ElementsSupport.TableRow(DomContainer, findBy, new ElementsInFirstTBody(this));

            if (row.Exists)
            {
                return(row);
            }

            return(null);
        }
Пример #4
0
        /// <summary>
        /// Finds te first row that has an exact match with <paramref name="findText"/> in <paramref name="inColumn"/>
        /// defined as a TD html element. If no match is found, null is returned. This method will look for rows in all
        /// <see cref="Core.TableBody"/> elements but will ignore rows in nested tables.
        /// </summary>
        /// <param name="findText">The text to find.</param>
        /// <param name="inColumn">Index of the column to find the text in.</param>
        /// <returns>The searched for <see cref="TableRow"/>; otherwise <c>null</c>.</returns>
        public TableRow FindRowInDirectChildren(string findText, int inColumn)
        {
            Logger.LogAction("Searching for '" + findText + "' in column " + inColumn + " of " + GetType().Name + " '" + Id + "'");

            TableRowAttributeConstraint constraint = new TableRowAttributeConstraint(findText, inColumn);

            if (TextIsInBody(constraint))
            {
                return(FindRowInDirectChildren(constraint));
            }
            return(null);
        }
Пример #5
0
        /// <summary>
        /// Finds the first row that meets the <see cref="TableRowAttributeConstraint"/>.
        /// If no match is found, <c>null</c> is returned.
        /// </summary>
        /// <param name="findBy">The constraint used to identify the table cell.</param>
        /// <returns>The searched for <see cref="TableRow"/>; otherwise <c>null</c>.</returns>
        public TableRow FindRowInDirectChildren(TableRowAttributeConstraint findBy)
        {
            ElementAttributeBag attributeBag = new ElementAttributeBag(DomContainer);

            ArrayList elements = IEElementFinder.FindElements(findBy, (ElementTag)Core.TableRow.ElementTags[0], attributeBag, true, new Rows(this));

            if (elements.Count > 0)
            {
                return(new TableRow(DomContainer, (IHTMLTableRow)elements[0]));
            }

            return(null);
        }
Пример #6
0
        private bool TextIsInBody(TableRowAttributeConstraint attributeConstraint)
        {
            string innertext = GetFirstTBody().innerText;

            return(innertext != null && attributeConstraint.IsTextContainedIn(innertext));
        }