win32com: makepy causes ie problems.
brueckd at tbye.com
brueckd at tbye.com
Thu Jul 18 23:32:09 EDT 2002
On Thu, 18 Jul 2002, David LeBlanc wrote:
> ie = DispatchEx('internetexplorer.application')
> ie.visible = 1
> ie.navigate('http://www.w3.org')
>
> time.sleep(2) # let the browser get to it, but sloppy - how to wait on
> browser ready?
>
> dom = ie.document
>
> I'm also interested, as the comment suggests, on how to wait for a browser
> to finish navigating before I query it's state?
Hi David,
I use a function like this:
def WaitForDoc(doc, extraDelay=0.0):
if extraDelay:
time.sleep(extraDelay)
while not (hasattr(doc, 'readyState') and doc.readyState == 'complete'):
time.sleep(0.1)
The only time I use the extraDelay parameter is when the link/button fires
some Javascript (e.g. form validation) that in turn loads a new document -
without that extra delay the function would return before the new document
even begins loading.
-Dave
More information about the Python-list
mailing list