zbatev Posted August 9, 2011 Posted August 9, 2011 (edited) How can I tick the check box based on the adjacent value (OPTION A, OPTION B...] I'm asking this because I'm not in control of the site and I observed that from time to time the input ID or NAME changes. <tr class="table_item"> <td align="center" style="width:10%;"> <input name="dGroup:_ctl3:my_checkbox" type="checkbox" id="dGroup__mcl3_my_checkbox" onclick="TakeAction()" value="0" /> </td> <td align="left" style="width:80%;">[OPTION A]</td> </tr> <tr class="table_item"> <td align="center" style="width:10%;"> <input name="dGroup:_ctl4:my_checkbox" type="checkbox" id="dGroup__mcl4_my_checkbox" onclick="TakeAction()" value="1" /> </td> <td align="left" style="width:80%;">[OPTION B]</td> </tr> <tr class="table_item"> <td align="center" style="width:10%;"> <input name="dGroup:_ctl5:my_checkbox" type="checkbox" id="dGroup__mcl5_my_checkbox" onclick="TakeAction()" value="2" /> </td> <td align="left" style="width:80%;">[OPTION C]</td> </tr> <tr class="table_item"> <td align="center" style="width:10%;"> <input name="dGroup:_ctl6:my_checkbox" type="checkbox" id="dGroup__mcl6_my_checkbox" onclick="TakeAction()" value="3" /> </td> <td align="left" style="width:80%;">[OPTION D]</td> </tr> <tr class="table_item"> <td align="center" style="width:10%;"> <input name="dGroup:_ctl7:my_checkbox" type="checkbox" id="dGroup__mcl7_my_checkbox" onclick="TakeAction()" value="4" /> </td> <td align="left" style="width:80%;">[OPTION E]</td> </tr> <tr class="table_item"> <td align="center" style="width:10%;"> <input name="dGroup:_ctl8:my_checkbox" type="checkbox" id="dGroup__mcl8_my_checkbox" onclick="TakeAction()" value="5" /> </td> <td align="left" style="width:80%;">[OPTION f]</td> </tr> Edited August 9, 2011 by zbatev
Bert Posted August 10, 2011 Posted August 10, 2011 ie.au3 in the helpfile The Vollatran project My blog: http://www.vollysinterestingshit.com/
wakillon Posted August 10, 2011 Posted August 10, 2011 Look at _IEFormElementCheckBoxSelect function. AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
zbatev Posted August 10, 2011 Author Posted August 10, 2011 (edited) ie.au3 in the helpfile yeah I am still lurking inside this help file Look at _IEFormElementCheckBoxSelect function. this is only good if the web developer has a default value and/or if there is an index but what if the checkbox is like this: <input id="chkboxIncluded" type="checkbox" name="chkboxIncluded" onclick="javascript:msgCounterMessage();" /> <label for="chkboxIncluded">Include?</label></td> Well I could use the click event in this case but I think it would be much safer to use the _IEFormElementCheckBoxSelect function to be able to explicitly assign a true/false(checked/unchecked) value to it. Edited August 10, 2011 by zbatev
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now