问题
I want to grab some data from a site. Usually I use mechanize
for such things, but now the site gives the data with JS. Alas, mechanize
doesn't support it.
What can I use instead?
回答1:
Here are some options:
- Selenium (tutorial)
- For headless automation, Selenium can be used in conjunction with PhantomJS
- WebKit
- Spidermonkey
Here are some code examples:
- PyQt4 + WebKit
- An example using PyQt4+WebKit, and redone with Selenium
来源:https://stackoverflow.com/questions/21777306/python-browser-emulator-with-js-support