0

I'm using mechanize to fill form on a website and now I run into a problem with dynamically-filled drop-down lists that are dependent on a previous selection.I have four drop-downs in a form which are dynamically populated and then user can submit the form.

Drop-down are :

  Continent                               
    -- Country                               #depends on continent
         -- state                                  #depends on Country
               --city                                      #depends on state

How can I select values from these drop-downs using python?

Anshul
  • 7,914
  • 12
  • 42
  • 65

1 Answers1

1

If values are dynamically filled, you can't do that since mechanize won't take care of runnig the javascript code as it will happen when displaying the page in a web browser.

You have some alternatives:

  • Send the POST request with the values from the form to simulate that it's been properly filled.
  • Use something like selenium or windmill to drive a real web browser that executes the javascript code that you need to populate the drow-down widgets.
jcollado
  • 39,419
  • 8
  • 102
  • 133