I have a table of 6 columns and some rows. For row 1 Col0 has a checkbox. Col 2 has the text "Name" and col 5 has the text "CRM" Row 2 col 2 has the text "Address" and has the text "CRM" Row 7 col 2 has the text "Name" and col 5 has the text "ESCR" The pattern goes on like this with rows of date.
I would like to select the checkbox from col0 where col2 has the text "Name" and col5 has the text "CRM"
How do i do this using XPATH please?
I have a made a start and I can identify the text "CRM" from col5. I need to get the correct row so I need to find "Name" and then go up to the checkbox.
My XPATH is:
//table[@id="data_configuration_variables_ct_fields_body"]/tbody/tr//td/div/span[@title="CRM" and contains(text(), "CRM")]
I would like to include the text "Name" in the XPATH and then include the checkbox. I can then select the correct row.
The HTML sample is (sorry for the long HTML - i don't know how to provide it in a shorter way):
<table id="data_configuration_variables_ct_fields_body" cellspacing="0" style="table-layout: fixed; width: 100%;">
<colgroup>
<tbody>
<tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="0">
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBHG">
<div __gwt_cell="cell-gwt-uid-1130" style="outline-style:none;" tabindex="0">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-1131" style="outline-style:none;">
<span class="linkhover" title="Name" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;color:#00A;cursor:pointer;">Name</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-1132" style="outline-style:none;">
<span class="" title="Name" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">Name</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-1133" style="outline-style:none;">
<span class="" title="" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-1134" style="outline-style:none;">
<span title="CRM" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">CRM</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBBH">
</tr>
<tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="1">
<td class="GJPPK2LBEG GJPPK2LBFH GJPPK2LBHG">
<div __gwt_cell="cell-gwt-uid-1130" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH">
<div __gwt_cell="cell-gwt-uid-1131" style="outline-style:none;">
<span class="linkhover" title="Address" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;color:#00A;cursor:pointer;">Address</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH">
<div __gwt_cell="cell-gwt-uid-1132" style="outline-style:none;">
<span class="" title="Address" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">Address</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH">
<div __gwt_cell="cell-gwt-uid-1133" style="outline-style:none;">
<span class="" title="" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH">
<div __gwt_cell="cell-gwt-uid-1134" style="outline-style:none;">
<span class="" title="CRM" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">CRM</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH GJPPK2LBBH">
</tr>
<tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="2">
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBHG">
<div __gwt_cell="cell-gwt-uid-1130" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-1131" style="outline-style:none;">
<span class="linkhover" title="DOB" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;color:#00A;cursor:pointer;">DOB</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-1132" style="outline-style:none;">
<span class="" title="DOB" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">DOB</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-1133" style="outline-style:none;">
<span class="" title="" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-1134" style="outline-style:none;">
<span class="" title="CRM" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">CRM</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBBH">
</tr>
<tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="3">
<td class="GJPPK2LBEG GJPPK2LBFH GJPPK2LBHG">
<div __gwt_cell="cell-gwt-uid-1130" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH">
<div __gwt_cell="cell-gwt-uid-1131" style="outline-style:none;">
<span class="linkhover" title="Phone" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;color:#00A;cursor:pointer;">Phone</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH">
<div __gwt_cell="cell-gwt-uid-1132" style="outline-style:none;">
<span class="" title="Phone" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">Phone</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH">
<div __gwt_cell="cell-gwt-uid-1133" style="outline-style:none;">
<span class="" title="" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH">
<div __gwt_cell="cell-gwt-uid-1134" style="outline-style:none;">
<span class="" title="CRM" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">CRM</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH GJPPK2LBBH">
</tr>
<tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="4">
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBHG">
<div __gwt_cell="cell-gwt-uid-1130" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-1131" style="outline-style:none;">
<span class="linkhover" title="Email" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;color:#00A;cursor:pointer;">Email</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-1132" style="outline-style:none;">
<span title="Email" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">Email</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-1133" style="outline-style:none;">
<span class="" title="" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-1134" style="outline-style:none;">
<span class="" title="CRM" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">CRM</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBBH">
<div __gwt_cell="cell-gwt-uid-1135" style="outline-style:none;">
<span class="" title="DM" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">DM</span>
</div>
</td>
</tr>
<tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="5">
<td class="GJPPK2LBEG GJPPK2LBFH GJPPK2LBHG">
<div __gwt_cell="cell-gwt-uid-1130" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH">
<div __gwt_cell="cell-gwt-uid-1131" style="outline-style:none;">
<span class="linkhover" title="ACVSEQ" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;color:#00A;cursor:pointer;">ACVSEQ</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH">
<div __gwt_cell="cell-gwt-uid-1132" style="outline-style:none;">
<span class="" title="ACVSEQ" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">ACVSEQ</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH">
<div __gwt_cell="cell-gwt-uid-1133" style="outline-style:none;">
<span class="" title="" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH">
<div __gwt_cell="cell-gwt-uid-1134" style="outline-style:none;">
<span class="" title="CRM" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">CRM</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBFH GJPPK2LBBH">
<div __gwt_cell="cell-gwt-uid-1135" style="outline-style:none;">
<span class="" title="DM" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">DM</span>
</div>
</td>
</tr>
<tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="6">
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBHG">
<div __gwt_cell="cell-gwt-uid-1130" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-1131" style="outline-style:none;">
<span class="linkhover" title="Name" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;color:#00A;cursor:pointer;">Name</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-1132" style="outline-style:none;">
<span class="" title="Name" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">Name</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-1133" style="outline-style:none;">
<span class="" title="" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;"/>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG">
<div __gwt_cell="cell-gwt-uid-1134" style="outline-style:none;">
<span class="" title="ESCR" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">ESCR</span>
</div>
</td>
<td class="GJPPK2LBEG GJPPK2LBGG GJPPK2LBBH">
<div __gwt_cell="cell-gwt-uid-1135" style="outline-style:none;">
<span class="" title="DM" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;empty-cells:show;display:block;padding-right: 1px;">DM</span>
</div>
</td>
</tr>
<tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="7">
<tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="8">
<tr class="GJPPK2LBEH" __gwt_subrow="0" __gwt_row="9">
<tr class="GJPPK2LBFG" __gwt_subrow="0" __gwt_row="10">
</tbody>
</table>
Thanks, Riaz