Alex Rivera | Logout

Mechanize and Javascript

Asked 2011-04-26T16:32:32.137
28

I want to use Mechanize to simulate browsing to a web page with active JavaScript, including DOM Events and AJAX, and so far I've found no way to do that.

I looked at some Python client browsers that support JavaScript like Spynner and Zope, and none of them really work for me. Spynner crashes PyQt all the time, and Zope doesn't support JavaScript as it seems.

Is there a way to simulate browsing with Python only (no extra processes) like WATIR or libraries that manipulate Firefox or Internet Explorer while supporting Javascript fully as if actually browsing the page?

Edit
Report

1 Answer

3

An example how to use PyV8, to run JS on a DOM with python can be found here:

https://github.com/buffer/thug

This should be fairly easy to make it run together with mechanize.

answered 2012-12-08T09:05:08.600

Your Answer