I have been expeirmenting with Watir, Nokogir and Hpricot. All of these use top->down approach which is my problem. i.e. they use element type to search element. I want to find out the element using the text without knowing element type. e.g.
<element1>
<element2> Text2 </element2>
<element3> Text3 </element3>
text4
</element1>
I want is to get element2 and element1 etc by searching for Text2 and Text3.
Please note that I do not know if elements are divs or tr/tds or links etc. I just know the text. Algorithem should be something like : iterated through all the elements, match inner text, if match get me the element and the parent element.
Let me kow if this is possible in any way?