I want to access an element using text() attribut of xpath having a structure like shown below.
<root>
<child>
<lowerchild>
<lowestchild>
My text
</lowestchild>
</lowerchild>
</child>
</root>
.
//child[contains(text(), 'My text')]
should return the child-element. and
//lowerchild[contains(text(), 'My text')]
should return the lowerchildelement.
I tried out the XPath-commands with HTMLAgilityPack, but they were not able to find those elements.
The final result of my little project is a small xpath-searcher, so the user gives the name of element the attribut and the value, so it would be great if you might give me a solution only using that information. It could be any random structure. if element names double themselves like if we had 2 lowestchild-elements, than i would like to pick the "lower" one of the lowest. Hope you can help me.