I’d like to know how to select options in a form that is formatted like
<td align="left">
<select name="FORM1" id="FORM1" multiple="multiple" size="5">
<option value="Value1">Value1</option>
<option value="Value2">Value2</option>
</select>
</td>
Right now, I am using mechanize to connect to the website and traverse to the desired page. This page has many forms such as FORM1, FORM2, FORM3, etc. with options. I’d like to select (enable) Value1 then tell the instance of mechanize to hit the submit button. Which would be a quick way to enable an option based on the form name?
Here are some basic usage examples to get you going:
Forms have a
nameattribute; sometimes it’s empty though:Forms have a sequence of controls; controls also have names:
You can get a listing of items in a control:
For radio buttons, you have to make a single selection:
But the selection has to be in a list:
For check boxes you can make multiple selections:
You can find more info here (link stolen from Matt Hempel :).