COM automation, Internet Explorer, DocumentComplete event

puff rbell01824 at earthlink.net
Tue Jan 10 18:23:35 EST 2006


Thanks very much Roger.

As you might have guessed, I'm rather new to Python.  The notion that
== does the job illustrates one of the reason's I've undertaken
learning yet another new language (40+ years on, the language count is
rather larger than I'd care to admit).  I should also mention the
fact that a newsgroup post actually gets an answer is a big plus.
Thanks again.

I was in a bit of a rush in my post about busy.  Let me take a minute
to explain on the off chance that someone else might benefit.

IE's busy attribute doesn't work for determining when a page has
fully downloaded.  It only indicates IE's internal work state.  If you
watch the event stream, busy, and readystate while pages are loading
you often see busy go false and then go true again fairly quickly.  So,
busy as a reliable check for page completely loaded is a fairly poor
choice.

I mentioned PAMIE.  It uses a technique that waits for busy false, then
readystate complete.  This is much better than simple busy, but suffers
from two flaws.  First the last time I looked at that PAMIE's code
the checks were serial.  So it can get confused by an early busy false,
then go into it's readystate complete check inappropriately early.
This aside, there are pages where during loading, busy is false and
ready state complete for a short time then more page content is
downloaded (watching the event stream from real world pages is a very
informative experience when it comes to a page being complete).

The technique suggested in the MS KB article, actually works fairly
well for determining when the page is in fact fully downloaded as a
result of the thing that started the navigation (lots of things other
than navigate can cause navigations, BTW).  It basically means that the
browser has all the bytes associated with the page in hand.
Unfortunately, it also fails (although rather less often than any
technique involving either busy or readystate) when the page has script
that mucks about with the DOM, causes additional activity over the web,
etc.

Thanks again.




More information about the Python-list mailing list