C# HTML get all checkboxes and press them randomly -
i desperate help. have tried checkboxes website , press them randomly. random function should choose 1 of 3 following checkboxes in list of checkboxes. : chooses randomly 1 checkbox checkbox 1 checkbox 4. chooses checkbox randomly checkbox 4 checkbox 7.
i have problems getting checkboxes , check 1 of them.
this html code 1 checkbox
<input id="m_embeddedprofilecontrol_m_questionsheet_ctl02_1012343_3056092_0" type="checkbox" name="m_embeddedprofilecontrol$m_questionsheet$ctl02$ctl00$1012343_3056092" onclick="javascript:return changecheckboxanswervalue(c1012343_3056092,3056092,'',1012343,true);"> and try far in visual studio 2013
htmlelementcollection test = wb.document.getelementsbytagname("input"); foreach (htmlelement blub in test) { if (blub.getattribute("type").equals("checkbox")) { blub.invokemember("onclick"); } }
how this:
private void checkonerandomly(htmlelement[] chks) { chks[convert.toint32(math.random()*chks.length)-1].invokemember("onclick"); }
Comments
Post a Comment