I do have the following html text:
<tr class="off" onmouseout="this.className='off'"onmouseover="this.className='over'">
<td><input type="checkbox" name="caller_enrollment_form:enrollmentParticipantSelectionTable:0:personSelection" id="caller_enrollment_form:enrollmentParticipantSelectionTable:0:personSelection" value="true" />
</td>
<td><span id="caller_enrollment_form:enrollmentParticipantSelectionTable:0:extClientId">111</span>
</td>
<td><span id="caller_enrollment_form:enrollmentParticipantSelectionTable:0:clientName">SAMUEL</span>
</td>
I am trying to click on the checkbox which has the data 111 in the same row.
I am trying to something like this:
page.FindChildByXPath("//span[contains(text(),'111')]/parent::td/preceding-sibling::td/input[@name='caller_enrollment_form:enrollmentParticipantSelectionTable:0:personSelection']",false)
but I get object not found error.
Your checkox has an ID, and IDs are unique within a page. So you can use:
The ID contains a number (0); you can use a variable to specify this number:
If you specifically need to identify by the text "111", you can use something like this:
You can also use a variable instead of "111":
XPath explanation: