My Html looks like this
<tr>
<td>
<span>
<img>fieldId:
</span>
</td>
<td>
<span>
<input value="false" type="text">
<input type="hidden" >
</span>
</td>
<td></td>
<td></td>
</tr>
I want to find the text input field but i know only fieldId which is present under 1st td/span/img I wrote xpath like this
//span[contains(text(),'fieldId')]/../following-sibling::td
But it finds all the td which is present after 1st td so i tried like this
//span[contains(text(),'fieldId')]/../following-sibling::td[0]
But this is not working
Where am i going wrong ??
please help
XPath index starts from 1, not 0 :
//span[contains(text(),'fieldId')]/../following-sibling::td[1]
Alternatively, you can try this way :
//td[contains(span, 'fieldId')]/following-sibling::td[1]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With