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); }
protected override bool DoCompare(IAttributeBag attributeBag) { Element element = null; ElementAttributeBag elementAttributeBag = attributeBag as ElementAttributeBag; if (elementAttributeBag != null) { element = elementAttributeBag.ElementTyped; } if (element == null) { element = attributeBag as Element; } if (element != null) { return(EvaluateAndOrAttributes(attributeBag, _comparer.Compare(element))); } throw new Exceptions.WatiNException("This constraint class can only be used to compare against an element"); }