Using relative XPath with Selenium, is there a way to get the text contents of following-sibling, using the text contents of both siblings as guidance?
<table class="table"> <tbody> <tr> <td>Looking for</td> <td class="text-right">This!</td> </tr> </tbody> </table> In the above example, I want to retreive the text snippet This! based on the text Looking for.
The path needs to be relative in the sense that these table cells can appear anywhere on the page. The above is a cut-out of the full web page. There can also be other things inserted before inside the same <tr> block.
I have tried this which seems to find the first cell:
//text()[contains(.,'Looking for')]
However, I'm struggling with how to proceed to get the text in the sibling.
My attempt has looked something like (incorrectly):
//text()[contains(.,'Looking for')]/following-sibling::text()
No comments:
Post a Comment