简体   繁体   中英

How can you use Python to fill out HTML forms that also have Javascript?

I am making a python program that automatically enters information into a form on a website. I looked at a module called mechanize at first but then I realized that it didn't support javascript. Is there any way to take a piece of information and insert it into a "form" on a website that uses javascript?

The website I am using is www.locationary.com.

If you login and then go to a place/business page like this,

http://www.locationary.com/place/en/US/California/Los_Angeles/Z_Pizza-p1001157911.jsp

then you will see a bunch of spots that need to be filled in. I looked at the page source and this "form" uses javascript. I just need a way to fill in those blanks now. Like I said, I tried mechanize and it didn't work but I also googled it and got nothing.

The "form" uses "onclick"

If you could offer any advice, I would really appreciate it.

Thanks.

I think probably the best way to do this is to use a framework that can operate through a browser. There are several options, but the most pythonic is windmill http://www.getwindmill.com/

I've found it useful on a number of projects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM