I would like to find the text inside html, then select the parent of the element so that I can use it to store the link identifier as a string. (I use watir for this, since the purpose of this is to automatically test)
so here is an example:
<html> <body> <div id="container"> <span class="story"> <span> ref4040 </span> </span> <div id="text"> example </div> </div> </body> </html>
Is there a way that I can use ruby ββto search for the text "example" and then select the parent so that I can store the reference identifier within the range as a string?
(I know that you can do this in a simple way in this example of selecting a div, then span, but in a project I'm actually working on, this is not possible. The only possible way to do this is to find the text then select the link.)
source share