<br><br><div class="gmail_quote">On Thu, Mar 19, 2009 at 1:25 AM, Carl <span dir="ltr"><<a href="mailto:tg2.user@gmail.com">tg2.user@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Probably the easiest thing is to actually use a browser. There are<br>
many examples of automating a browser via Python. So, you can<br>
programmatically launch the browser, point it to the JavaScript<br>
afflicted page, let the JS run and grab the page source. As an added<br>
bonus you can later interact with the page by programatically, filling<br>
form fields, selecting options from lists and clicking buttons.<br>
<br>
HTH, Carl<br>
<div><div></div><div class="h5">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div><br><br>I've been using the python port of mechanize (specifically mechanize.browser) for web automation, it's rather nice.[1]<br><br>In the vast majority of cases, if I need something done with javascript, it's just to generate a url or post data - in which case I can just read the javascript, and figure out what it's doing - or use something like livehttpheaders[2] to find out what I need to be sending.<br>
<br>This obviously doesn't cover every single case, but it works pretty fine most of the time. I would love to see a complete javascript interpreter / dom interface in python - but it's hard, hard stuff. <br><br>I'd love to even have the time to read the ECMAScript spec enough to have enough working knowledge of javascript's internals to be able to contribute to one of the current attempts at doing so.<br>
<br>1. <a href="http://wwwsearch.sourceforge.net/mechanize/">http://wwwsearch.sourceforge.net/mechanize/</a><br>2. <a href="https://addons.mozilla.org/en-US/firefox/addon/3829">https://addons.mozilla.org/en-US/firefox/addon/3829</a><br>