[python-win32] re: IE & DocumentComplete

Roger Upole rwupole at msn.com
Tue Jul 8 20:24:15 CEST 2008


aaron wrote:
> Sorry if this is a repeat, but the information on the web regarding
> DocumentComplete and IE is not helping me find a solution.
>
> I read a 2000 thread that documentcomplete was 'broken'.. is this still
> the case?  If not, does anyone mind sending me a snippet of some
> working code where it's used?  I feel like I'm running in circles here.
>
> Using the Busy and readyState attributes are proving to be a waste of
> time without long pausing to make sure the content is actually
> loaded.
>
> Thanks,
>
> A


As far as I know, it works in any recent build.

import pythoncom
import win32com.client

defaultNamedNotOptArg=pythoncom.Missing

class ieevents:
    def OnNavigateComplete2(self, pDisp=defaultNamedNotOptArg, 
URL=defaultNamedNotOptArg):
        print 'OnNavigateComplete2', URL

    def OnDocumentComplete(self, pDisp=defaultNamedNotOptArg, 
URL=defaultNamedNotOptArg):
        print 'OnDocumentComplete', URL, pDisp==self._oleobj_

ie=win32com.client.DispatchWithEvents('internetexplorer.application', 
ieevents)
ie.Visible=1
ie.Navigate('http://sourceforge.net/projects/pywin32/')

         Roger



More information about the python-win32 mailing list