Reputation: 23
I have difficulty coming up with the right XPath for the label element.
<td class="">
<div class="ui fitted read-only checkbox">
<input class="hidden" name="id" readonly="" tabindex="0" type="checkbox" value="">
<label></label>
</div>
</td>
<td class="">Sara Parker</td>
Upvotes: 2
Views: 334
Reputation: 25746
kjhughes has got the right XPath but if you are open to other locators, a CSS selector is shorter/simpler
input[name="id"] + label
They both will do the same thing but CSS selectors are faster, better supported, and I think easier to read.
Upvotes: 1
Reputation: 111726
This XPath,
//input[@name="id"]/following-sibling::label
will select all following label
sibling elements to input
elements with name
attributes equal to id
.
Upvotes: 1