How to select text between two nodes

I would like to select some text from a webpage using Xpath, but this text is between two nodes.

...
<table>
    <th>Abbreviation</th>
    <tr>
        <td>
            <span><u>General</u><br/></span>
            My Text <!--The text i want to get-->
            <br/><u>Def</u>
            Some other Text
       </td>
</table>
...

Please note that I cannot change the page, as this is a source that I cannot control.

I already went through the W3C and wikipedia docs and did not find anything (or understood).

thank you for your responses

+5
source share
1 answer

You can use the following XPath expression. It searches spanwith a child u, then selects the first next text.

//span[u]/following-sibling::text()[1]
+7
source

All Articles