I have an HTML page that contains a table with various rows
<table>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td><strong>myTd</strong></td>
</tr>
<tr>
<td></td>
</tr>
</table>
At the moment I have an XPath to find td that contains myTd text,
/table/tbody/tr/td/strong[text()="myTd"]
but now, I need to collect all previous tr from actual td (in this example, first four tr occurrences). I tried the following XPath, but it only returns the context row (fifth tr).
/table/tbody/tr/td/strong[text()="myTd"]/ancestor::tr