Checking random checkboxes

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
Erat
Posts: 2
Joined: Wed Oct 21, 2009 10:23 am

Checking random checkboxes

Post by Erat » Wed Oct 21, 2009 10:47 am

Hi,
I am trying to automate a form filling that involves checking 40 random checkboxes. Also there are limitations on which checkboxes can be checked and which cannot. here is an image that shows what I am trying to achieve:
Image

There are four sections in this image, each one separated by a bolded header. And I need to check one checkbox in each section, and this one is random in each section.If I select more than one, a popup appears and says that i can select only one.

The HTML code looks like this:

Code: Select all

<tr bgcolor="#fafafa"><td></td><td><b> Free Weight Loss Meal Plans</b></td></tr>
<tr bgcolor="#fafafa"><td><input name="box[2014]" value="22601" id="box2014_1" onclick="boxchk(this)" type="checkbox"></td><td>Entertainment</td></tr>
<tr bgcolor="#fafafa"><td><input name="box[2014]" value="22606" id="box2014_2" onclick="boxchk(this)" type="checkbox"></td><td>News</td></tr>
<tr bgcolor="#fafafa"><td><input name="box[2014]" value="22603" id="box2014_3" onclick="boxchk(this)" type="checkbox"></td><td>Free Meal Weight Loss Plans</td></tr>
<tr bgcolor="#fafafa"><td><input name="box[2014]" value="22600" id="box2014_4" onclick="boxchk(this)" type="checkbox"></td><td>Diet & Fitness</td></tr>

<tr bgcolor="#fafafa"><td><input name="box[2014]" value="22605" id="box2014_5" onclick="boxchk(this)" type="checkbox"></td><td>Howto</td></tr>
<tr bgcolor="#fafafa"><td><input name="box[2014]" value="22602" id="box2014_6" onclick="boxchk(this)" type="checkbox"></td><td>Film</td></tr>
<tr bgcolor="#fafafa"><td><input name="box[2014]" value="22607" id="box2014_7" onclick="boxchk(this)" type="checkbox"></td><td>People</td></tr>
<tr bgcolor="#fafafa"><td><input name="box[2014]" value="22604" id="box2014_8" onclick="boxchk(this)" type="checkbox"></td><td>Free Weight Loss Plans</td></tr>
<tr bgcolor="#fafafa"><td></td><td><b>A Pet Lovers Haven</b></td></tr>
<tr bgcolor="#fafafa"><td><input name="box[5000]" value="64901" id="box5000_1" onclick="boxchk(this)" type="checkbox"></td><td>Pet Health</td></tr>
<tr bgcolor="#fafafa"><td></td><td><b>A Yoga Blog</b></td></tr>
<tr bgcolor="#fafafa"><td><input name="box[1255]" value="14759" id="box1255_1" onclick="boxchk(this)" type="checkbox"></td><td>Health</td></tr>
<tr bgcolor="#fafafa"><td><input name="box[1255]" value="14763" id="box1255_2" onclick="boxchk(this)" type="checkbox"></td><td>weight loss</td></tr>

<tr bgcolor="#fafafa"><td></td><td><b>Abdominal Exercises with Healthgenie</b></td></tr>
<tr bgcolor="#fafafa"><td><input name="box[977]" value="10333" id="box977_1" onclick="boxchk(this)" type="checkbox"></td><td>safe abdominal exercises</td></tr>
<tr bgcolor="#fafafa"><td><input name="box[977]" value="10335" id="box977_2" onclick="boxchk(this)" type="checkbox"></td><td>Welcome</td></tr>
<tr bgcolor="#fafafa"><td><input name="box[977]" value="10332" id="box977_3" onclick="boxchk(this)" type="checkbox"></td><td>poor exercise techniques</td></tr>
<tr bgcolor="#fafafa"><td><input name="box[977]" value="10334" id="box977_4" onclick="boxchk(this)" type="checkbox"></td><td>Uncategorized</td></tr>
<tr bgcolor="#fafafa"><td><input name="box[977]" value="10331" id="box977_5" onclick="boxchk(this)" type="checkbox"></td><td>abs exercises</td> 
As you can see, each checkbox has different values for attributes, and this is going to change for each run.
I tried using:

Code: Select all

SET !LOOP 40
TAG POS={{!LOOP}} TYPE=INPUT:CHECKBOX FORM=NAME:post_form ATTR=ID:* CONTENT=YES
but it doesnt work.
I am very new to this. Can anyone give me an idea how to go about doing it? I will appreciate it very much. Thanks

Erat
Erat
Posts: 2
Joined: Wed Oct 21, 2009 10:23 am

Re: Checking random checkboxes

Post by Erat » Sun Dec 20, 2009 9:19 am

Waited for two months, still it seems to be very silent in this thread. Can any1 help me?
MattBell7
Posts: 627
Joined: Thu Nov 26, 2009 11:07 am
Location: United Kingdom

Re: Checking random checkboxes

Post by MattBell7 » Mon Dec 21, 2009 9:30 am

try

Code: Select all

TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:post_form ATTR=ID:box2014* CONTENT=YES
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:post_form ATTR=ID:box5000* CONTENT=YES
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:post_form ATTR=ID:box1255* CONTENT=YES
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:post_form ATTR=ID:box977* CONTENT=YES
this will select the first option in each of the 4 groups, regardless of the content. If you want to select a truly random value, you'll need to use the scripting interface.
Post Reply