I use mechanize to fill out forms, and I'm having a problem with dynamically populated drop-down lists, which depend on the previous selection.
In mechanization, I do something like this to select a category:
import mechanize
br = mechanize.Browser()
"""Select the form and set up the browser"""
br["state"] = ["California"]
br["city"] = ["San Francisco"]
br.submit()
I cannot select a city as “San Francisco” until I select a state as “California” because the city drop-down list is dynamically populated after selecting “California”.
How can I send a city using Python and mechanize?
source
share