Reputation: 287410
I have this XPath:
//tr[contains(td, 'Europe')]
which was working when I had this:
<tr>
<td></td>
<td>Europe</td>
<td></td>
</tr>
but now I have this:
<tr>
<td></td>
<td><a>Europe</a></td>
<td></td>
</tr>
How can I get with an XPath now (based on the fact that Europe is in there).
I tried:
//tr[contains(a, "Europe")]
and
//tr[contains(text(), "Europe")]
and many other silly things without any success.
Upvotes: 0
Views: 823
Reputation:
//tr[contains(td, 'Europe')]
This should work with both schema because fn:contains()
cast both arguments to strings.
I do see a problem with a different schema where there can be more than one td
element. For that case you should use:
//tr[td[contains(.,'Europe')]]
Upvotes: 4