Select value in drop down list

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
MattBell7
Posts: 627
Joined: Thu Nov 26, 2009 11:07 am
Location: United Kingdom

Select value in drop down list

Post by MattBell7 » Fri Dec 18, 2009 2:43 pm

Im trying to code a macro part of which is selecting a value from a dropdown list, the HTML for the DD list is as follows:

Code: Select all

<select id="role" name="roleList">
<option selected="selected" value="-1">Select role</option>
<option value="0">Role 1</option>
<option value="1">Role 2</option>
<option value="2">Role 3</option>
<option value="3">Role 4</option>
<option value="4">Role 5</option>
</select>
iMacros automatically generates this to select Role 2

Code: Select all

TAG POS=1 TYPE=SELECT ATTR=ID:role CONTENT=%1
but what i'd like to do is select it based on the text (e.g. Role 2). I cant just use this tag as the list may change order (Role 2 may become item 0 in the list).

Thanks
MattBell7
Posts: 627
Joined: Thu Nov 26, 2009 11:07 am
Location: United Kingdom

Re: Select value in drop down list

Post by MattBell7 » Fri Dec 18, 2009 3:23 pm

nevermind, finally found the answer on the wiki
To select an entry by its name add a $ before the name so that the command looks like

Code: Select all

TAG POS=1 TYPE=SELECT FORM=NAME:form1 ATTR=NAME:select1 CONTENT=$Apple 
Post Reply