Reputation: 11395
Here's what I have right now:
//tr[.//*[@id = string(../label[.='foo']/@for) and @value='bar']]
I know this works:
//tr[.//label[.='foo']/@for]
I also confirmed that the string()
function works as expected, but it seems to be hung up on matching the string()
against the id
attribute. Any idea why?
Here's a bit of X[HT]ML that should match this - it should find the second row:
<tr>
<td>
<label for="thing1">foo</label>
<input id="thing1" value="not-bar" />
</td>
</tr>
<tr>
<td>
<label for="thing2">foo</label>
<input id="thing2" value="bar" />
</td>
</tr>
Thanks!
Upvotes: 0
Views: 1543
Reputation: 5892
//tr[*/input
[@id = ../label[.='foo']/@for and @value='bar']
]
Looks sufficient.
Upvotes: 2