I have an ASP.NET page (located here: http://www.kraftrecipes.com/Products/ProductMain.aspx) that has a dropdown box of various food brands. I'm trying to use Mechanize in Python so I can click on each item in the list, go to the product list page, and eventually use BeautifulSoup to scrape product information. Here's some of the HTML:
<fieldset class="pulldownfieldset">
<label>...or use the pulldown menu below.</label>
<select name="ctl00$SPWebPartManager1$g_9bdf5859_9c73_4144_8b6a_9a3b3df417d5$ctl01$ddlBrand"
id="ctl00_SPWebPartManager1_g_9bdf5859_9c73_4144_8b6a_9a3b3df417d5_ctl01_ddlBrand"
onkeypress="return doSubmit(event, 'ctl00_SPWebPartManager1_g_9bdf5859_9c73_4144_8b6a_9a3b3df417d5_ctl01_btnBrandGo');">
<option value="322">Arrowroot</option>
<option value="1">A.1. Steak Sauces and Marinades</option>
etc.
At first I just tried selecting the form, but Python complained that it didn't exist.
browser.select_form("ctl00$SPWebPartManager1$g_9bdf5859_9c73_4144_8b6a_9a3b3df417d5$ctl01$ddlBrand")
When I do this:
browser.select_form(nr=0)
print browser.form
I get a list of all of the forms, but doing browser.form.name
yields "aspnetForm", which leads me to believe that Mechanize sees everything on the page as one big form. If this is true, how can I get at the selections in the dropdown box and submit them?
Let me know if you need more information.
Thanks.