Selecting Radio Buttons by Label

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Selecting Radio Buttons by Label

by SeaDude on Fri Oct 23, 2015 11:46 am

Hello,

How do I select a radio button where the options change between page loads? I want to select the radio based on its label, but here is the syntax that the developer used:

Code: Select all
<h1>What is your favorite beer?</h1>

<form action="/polls/1/vote/" method="post">
<input type='hidden' name='csrfmiddlewaretoken' value='N5yPaEUUbWBt1d7YvGza5PyO7XjEXOIB' />

    <input type="radio" name="choice" id="choice1" value="2" />
    <label for="choice1">Stone IPA</label><br />

    <input type="radio" name="choice" id="choice2" value="1" />
    <label for="choice2">Lucille IPA</label><br />

    <input type="radio" name="choice" id="choice3" value="3" />
    <label for="choice3">Laurelwood IPA</label><br />

<input type="submit" value="Vote" />
</form>


iMacros is recording the macro like this:
Code: Select all
VERSION BUILD=8340723 RECORDER=CR
URL GOTO=http://xx.xx.xx.xx:xxxx/polls/1/
TAG POS=1 TYPE=INPUT:RADIO FORM=ACTION:/polls/1/vote/ ATTR=ID:choice3
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:/polls/1/vote/ ATTR=*
TAG POS=1 TYPE=A ATTR=TXT:Vote<SP>again?


I've tried to adjust the ATTR=ID:choice3 to variants of the option I want (in this case "Laurelwood IPA") but keep getting Syntax and Runtime errors.

Remember, in this case, sometimes "choice3" will be the desired selection, sometimes "choice3" will be labeled with the one I want to select, and other times "choice3" will be labeled with another option.

Any help is appreciated.

Thanks
SeaDude
 
Posts: 3
Joined: Fri Oct 23, 2015 11:39 am

Re: Selecting Radio Buttons by Label

by chivracq on Fri Oct 23, 2015 12:12 pm

SeaDude wrote:Hello,

How do I select a radio button where the options change between page loads? I want to select the radio based on its label, but here is the syntax that the developer used:

Code: Select all
<h1>What is your favorite beer?</h1>

<form action="/polls/1/vote/" method="post">
<input type='hidden' name='csrfmiddlewaretoken' value='N5yPaEUUbWBt1d7YvGza5PyO7XjEXOIB' />

    <input type="radio" name="choice" id="choice1" value="2" />
    <label for="choice1">Stone IPA</label><br />

    <input type="radio" name="choice" id="choice2" value="1" />
    <label for="choice2">Lucille IPA</label><br />

    <input type="radio" name="choice" id="choice3" value="3" />
    <label for="choice3">Laurelwood IPA</label><br />

<input type="submit" value="Vote" />
</form>


iMacros is recording the macro like this:
Code: Select all
VERSION BUILD=8340723 RECORDER=CR
URL GOTO=http://xx.xx.xx.xx:xxxx/polls/1/
TAG POS=1 TYPE=INPUT:RADIO FORM=ACTION:/polls/1/vote/ ATTR=ID:choice3
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:/polls/1/vote/ ATTR=*
TAG POS=1 TYPE=A ATTR=TXT:Vote<SP>again?


I've tried to adjust the ATTR=ID:choice3 to variants of the option I want (in this case "Laurelwood IPA") but keep getting Syntax and Runtime errors.

Remember, in this case, sometimes "choice3" will be the desired selection, sometimes "choice3" will be labeled with the one I want to select, and other times "choice3" will be labeled with another option.

Any help is appreciated.

Thanks

Your Question has nothing to do with the 'Command Interface', try to select the correct Sub-Forum next time you start a Thread... :roll:
(The 'General' Sub-Forum would have been the correct one in this case, but don't duplicate your Thread...)

FCIM...! => iMacros for CR v8.34, CR43...?, OS...?

And, hum..., I'm afraid I won't help you with your Question, I don't help Users who want to (mis)use iMacros for Spam or cheating on Games and Votes, even if in your case, the "Vote<SP>again?" seems to imply it could be legit... Provide the URL of the Site if you think that might change my mind... Good luck with other (Advanced) Users otherwise...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6479
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Selecting Radio Buttons by Label

by SeaDude on Fri Oct 23, 2015 1:05 pm

Nice reply. I wonder how many of your other 3k+ posts were equally as useless.

This is my friends first web app, which is why the IP is x'd out in my post. I stumbled onto iMacros when searching for a way to test his site without sitting there and selecting things manually.

"Scripting" or "General" hm? Where should I paste this macro code into?

It would benefit the community to tone down your assumptions.
SeaDude
 
Posts: 3
Joined: Fri Oct 23, 2015 11:39 am

Re: Selecting Radio Buttons by Label

by chivracq on Fri Oct 23, 2015 8:09 pm

Okay..., strange Reply, I'm usually your best Friend on this Forum... :shock:

SeaDude wrote:Nice reply. I wonder how many of your other 3k+ posts were equally as useless.

Good Question, and actually the beginning of the Answer to your original Question, read them all and you will be an Expert and won't need anybody to answer your Questions...:
search.php?author_id=23592&sr=posts
Happy reading...! :twisted:

SeaDude wrote:This is my friends first web app, which is why the IP is x'd out in my post. I stumbled onto iMacros when searching for a way to test his site without sitting there and selecting things manually.

Beh, OK, this sounds like a good Explanation and a legit use of iMacros, no need to react like you do, if your Friend is developing an App for some Voting Stuff, he/she wouldn't be happy that People mis(use) his/her App to vote multiple times, rendering the Results completely fake and useless, he/she would be happy that I say that I don't want to help People who want to do so... :roll:

SeaDude wrote:"Scripting" or "General" hm? Where should I paste this macro code into?

I don't understand your Reply, I was talking about selecting the correct Sub-Forum..., your Question is a Question for the 'General' Sub-Forum and has nothing to do with the 'Scripting Interface and Command Line' using VBS, Delphi, Perl, C++ or whatever Programming Language... But don't worry, it's not too bad, Threads can always be moved the correct Sub-Forum...

SeaDude wrote:It would benefit the community to tone down your assumptions.

That's a good Project for your Friend to start a Vote-App to assess the possible Benefit for the "Community" (that you obviously think to represent... :roll: ) for "me toning down" my Replies... Okay, willing to work on it... :(
Your Statement is hum..., an "Assumption" if I try to be logical and use your way of thinking...

Mini-Advice (for here and any other Technical Forum):
Arguing with Advanced Users willing to help you as soon as you join a Forum is usually not a very good idea to get some Help... :idea:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6479
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Selecting Radio Buttons by Label

by SeaDude on Sat Oct 24, 2015 11:06 am

Thanks for the dramatic breakdown. Next time just follow your own advice and "dont respond to questions without the required information"

My first post was a legitimate question, formatted concisely and complete. When you attack its premise based on your own assumptions, your being ignorant.

Understand, then scrutinize. Without all the facts your words are hollow and truly, you sound pompous.
SeaDude
 
Posts: 3
Joined: Fri Oct 23, 2015 11:39 am

Re: Selecting Radio Buttons by Label

by techimac on Mon Nov 09, 2015 2:51 pm

SeaDude wrote:iMacros is recording the macro like this:
Code: Select all
VERSION BUILD=8340723 RECORDER=CR
URL GOTO=http://xx.xx.xx.xx:xxxx/polls/1/
TAG POS=1 TYPE=INPUT:RADIO FORM=ACTION:/polls/1/vote/ ATTR=ID:choice3
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:/polls/1/vote/ ATTR=*
TAG POS=1 TYPE=A ATTR=TXT:Vote<SP>again?


I've tried to adjust the ATTR=ID:choice3 to variants of the option I want (in this case "Laurelwood IPA") but keep getting Syntax and Runtime errors.

Thanks


TAG POS=1 TYPE=LABEL FORM=ACTION:/polls/1/vote/ ATTR=TXT:Laurelwood<SP>IPA
techimac
 
Posts: 189
Joined: Fri Feb 20, 2015 2:27 pm


Return to Scripting and Command Line Interface

Who is online

Users browsing this forum: No registered users and 4 guests

-->