I need help selecting a specific checkbox from a list of checkboxes in a table. The XPATH I've tried is not working as intended and ends up selecting all the checkboxes.
//table[@id="match_configuration_add_possible_tab_match_rules_tb_match_rules"]//input[@type = "checkbox"]
Here is the relevant HTML:
<table id="match_configuration_add_possible_tab_match_rules_tb_match_rules" class="GOFU2OVJE border" cellspacing="0" __gwtcellbasedwidgetimpldispatchingfocus="true" __gwtcellbasedwidgetimpldispatchingblur="true">
<thead aria-hidden="false">
<tr __gwt_header_row="0">
<th class="GOFU2OVID GOFU2OVGD" __gwt_header="header-gwt-uid-311" __gwt_column="column-gwt-uid-310" colspan="1">
<span style="">
<input type="checkbox"/>
</span>
</th>
<th class="GOFU2OVID GOFU2OVAE" __gwt_header="header-gwt-uid-313" __gwt_column="column-gwt-uid-312" colspan="1">Name</th>
</tr>
</thead>
<colgroup>
<tbody style="">
<tr class="GOFU2OVCD GOFU2OVMD" __gwt_subrow="0" __gwt_row="0">
<td class="GOFU2OVBD GOFU2OVDD GOFU2OVED GOFU2OVND">
<div __gwt_cell="cell-gwt-uid-299" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GOFU2OVBD GOFU2OVDD GOFU2OVOD GOFU2OVLD GOFU2OVND">
<div __gwt_cell="cell-gwt-uid-300" style="outline-style:none;">
<input id="" class="" type="text" style="color: blue;" value=""/>
</div>
</td>
</tr>
<tr class="GOFU2OVCE GOFU2OVJD" __gwt_subrow="0" __gwt_row="1">
<td class="GOFU2OVBD GOFU2OVDE GOFU2OVED GOFU2OVKD">
<div __gwt_cell="cell-gwt-uid-299" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GOFU2OVBD GOFU2OVDE GOFU2OVOD GOFU2OVKD">
</tr>
</tbody>
<tbody style="display: none;">
<tfoot style="display: none;" aria-hidden="true"/>
</table>
I'm trying to select the checkbox with attribute cell-gwt-uid-299 without using the UID value directly in the XPATH because it changes dynamically. Can you suggest an alternative XPATH?
I've also attempted using ancestor and preceding axes, but they are selecting checkboxes from other tables. Here's an example of what was highlighted when using preceding:
//table[@id="match_configuration_add_possible_tab_match_rules_tb_match_rules"]/preceding::tr[1]//input[@type = "checkbox"]
What would be the correct XPATH to target the desired checkbox?