Hi,

Python can't run Javascript functions. Note that "HTTPCookieProcessor"
is a HTTP thing, so it can handle  "http:" links, not "javascript:"
links.

Your best bet would probably be to download all the Javascript files
mentioned in the original HTML file, and try to find out what the
toggleBackpack() function does. If you can find out from that
Javascript function what the URL is that it opens in the new window,
then you can download that same URL from Python.

There is no such thing as a "Javascript window". Javascript can be
used to open perfectly normal windows, that contain normal HTML.

It's hard to give more help without knowing more about your problem.

Hope this helps a little,
Remco Gerlich

On Nov 27, 2007 1:10 AM, Chiar Nimeni <[EMAIL PROTECTED]> wrote:
> i basicly need python to open a certain javascript window ... then read it's
> source ... how do i do that?
>
> -----------------------------
> import urllib2
> import cookielib
>
> cj = cookielib.CookieJar()
> opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
>
> url = opener.open("The url that has a javascript window toggled on click")
> js = opener.open('javascript:toggleBackpack(null,2190551);')  # opening the
> JS window
> js2 = opener.open("javascript:toggleBackpack('orb',2190551);") # toggleing
> another section on the JS window
> source = js2.read()
> print source
>
>  ________________________________
> Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how.
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to