COM (DispatchEx) problem

Paul McGuire ptmcg at austin.rr._bogus_.com
Mon Aug 16 09:54:12 EDT 2004


"Leszek" <domcio_ at poczta.onet.pl> wrote in message
news:cfpqlu$nb6$1 at nemesis.news.tpi.pl...
> Hi everybody !
>
> I'm starting my script with:
>
> ie = win32com.client.DispatchEx("InternetExplorer.Application")
> ie.Visible = 1
> ie.Navigate("http://www.chip.pl")
>
> while ie.Busy == True:
>     win32api.Sleep(1000)
>
> doc = ie.document
>
> then I make "submit" and new page opens.
> but
>
> print doc.body.innerHtml
>
> gives the same Html code than before "submit". What is going on ? How to
see
> new document ?
>
> Thanks for any help.
>
> Leszek
>
If you are just trying to get at the HTML source for a given URL, use urllib
or urllib2.

Here's the code to get the HTML source for yahoo.com:

import urllib
serverListPage = urllib.urlopen( "http://www.yahoo.com" )
htmlSource = serverListPage.read()
serverListPage.close()

Bypasses the whole COM and IE mess, and it's portable, to boot!

-- Paul







More information about the Python-list mailing list