Is there anyway to run JavaScript in python?
Roy Smith
roy at panix.com
Thu Dec 30 09:11:09 EST 2010
In article
<a05193b8-46cd-4d17-a8d4-fb9106d3a79a at n32g2000pre.googlegroups.com>,
crow <wentlv at gmail.com> wrote:
> Hi, I'm writing a test tool to simulate Web browser. Is there anyway
> to run JavaScript in python? Thanks in advance.
The answer to the question you asked is, "Probably. You might want to
check out SpiderMonkey as a starting point".
The answer to the question you didn't ask is, "Before you invest a lot
of effort in this, check out Selenium".
http://en.wikipedia.org/wiki/SpiderMonkey_(JavaScript_engine)
http://en.wikipedia.org/wiki/Selenium_(software)
Another thing to think about is whether you really do need JS to test
your web app. Depending on how much your app depends on JS for its core
functionality, you may find that just using urllib to fetch pages,
parsing the HTML with lxml, and verifying that certain data exists in
the appropriate HTML elements might get you 80% of the testing value for
20% of the effort. But, I digress.
More information about the Python-list
mailing list