0

it is a html including two forms. One of them is generated dynamic by js when the page is loaded

So, if I try to fetch them, only one form could be return, and the form generated dynamic not found.

the question is

how to fetch all forms even if they are generated by js.

user496894
  • 51
  • 1
  • 6

3 Answers3

1

As far as I know Mechanize does not handle javascript.

That means that you should either generate the form yourself - by reading the JS that creates the form, and then "translating" it to python, and inserting it in your script. -

or: Automate an actual browser that does understand Javascript using something like ruby's Watir

Ole
  • 1,363
  • 12
  • 22
1

Launch Firefox, use HTTP Live Headers to inspect what the javascript does, then imitate that using Mechanize / relevant HTTP requests.

snoofkin
  • 8,725
  • 14
  • 49
  • 86
0

Use a browser that understands javascript as per WWW::Mechnize::FAQ, a browser like WWW::Mechanize::Firefox or WWW::Scripter