2

I am trying to get the available flights data from a website using mechanize and python, http://www.jet4you.com but the drop down list control shows "none" for the available items. Is there anyway to get the <options> using mechanize, urllib, or beautifulsoup?

When I submit a form using fiddler I see the values of the dropdown list but I cannot select them using mechanize.

br = mechanize.Browser()
br.possible_items("AvailabilityCompactSearchInputViewType$DropDownListMarketOrigin1")
["none"]
Tom van der Woerdt
  • 29,532
  • 7
  • 72
  • 105
Anass Kartit
  • 2,017
  • 15
  • 22
  • 2
    If the dropdown values are loaded from an AJAX call you'll need to either sniff the AJAX requests to the server and emulate them or use something more powerful, that can handle JavaScript and has a full DOM implementation. – em70 Dec 26 '11 at 14:57
  • I think @emaster70 is right. You'll find more help in the answers to this [question](http://stackoverflow.com/q/8323728/183066). – jcollado Dec 26 '11 at 15:35

1 Answers1

1

Give up on Mechanize for javascript. Use a javascript-able browser emulator, such as selenium. I've tried mechanize for this also, but it just fails.

Snakes and Coffee
  • 8,747
  • 4
  • 40
  • 60
  • [Splinter](http://splinter.cobrateam.info/) can be really helpful and considerably easier than pure Selenium. – brandizzi Apr 04 '12 at 19:14