I'm automating a task using Ruby and Watir.
I want to set a checkbox (which is in the first column of a table) based on whether the value in the second column matches my input value. For example, in the following code snippet, the value "brett58" matches my input value so I want to set the checkbox associated with it.
<tr class="cuesTableRowOdd">
<td align="center">
<input class="content-nogroove" type="checkbox" name="result[1].chked" value="true">
<input type="hidden" value="7bd67e4d-a59f-0143-3886-22c1d205a5c1" name="result[1].col[0].stringVal">
<input type="hidden" value="brett58" name="result[1].col[1].stringVal">
</td>
<td align="left">
<a class="cuesTextLink" href="userEdit.do?key=7bd67e4d-a59f-0143-3886-22c1d205a5c1">brett58</a>
</td>
<td align="left">brett</td>
<td align="left">lee</td>
<td align="left"></td>
</tr>
But I'm unable to do it. In the above case, the following line serves the purpose (as my input value matches with that it first row):
browser.table(:class, "cuesTableBg").checkbox(:name, "result[1].chked").click
But it can't be used as the required value might not always be in the first row.
Looping through all the rows is one option but it's inefficient.