public override bool Compare(IAttributeBag attributeBag) { ElementAttributeBag elementAttributeBag = (ElementAttributeBag)attributeBag; IHTMLElement element = elementAttributeBag.IHTMLElement; if (IsTextContainedIn(element.innerText)) { // Get all elements and filter this for TableCells IHTMLTableRow tableRowElement = (IHTMLTableRow)element; IHTMLElementCollection tableCellElements = tableRowElement.cells; if (tableCellElements.length - 1 >= columnIndex) { IHTMLTableCell tableCell = (IHTMLTableCell)tableCellElements.item(columnIndex, null); ICompareElement elementComparer = comparer as ICompareElement; if (elementComparer != null) { return(elementComparer.Compare(new TableCell(elementAttributeBag.DomContainer, tableCell))); } return(base.Compare(new ElementAttributeBag(elementAttributeBag.DomContainer, (IHTMLElement)tableCell))); } } return(false); }
/// <summary> /// Find an Element by using a specialized Element comparer /// </summary> /// <param name="comparer">The comparer</param> /// <returns>An ElementConstraint instance</returns> public static ElementConstraint ByElement(ICompareElement comparer) { return(new ElementConstraint(comparer)); }
public ElementConstraint(ICompareElement comparer) { _comparer = comparer; }