problem with from win32com.client import Dispatch
calfdog at yahoo.com
calfdog at yahoo.com
Mon Nov 14 10:14:27 EST 2005
Hello,
If you want some goood examples of reading Web pages and automating
this process
I have a class that wraps all these functions.
http://pamie.sourceforge.net
But for your problem:
You are trying to read the page before it is completely loaded
either add a wait function or a simple sleep ( see below)
from win32com.client import Dispatch
import time
ie = Dispatch("InternetExplorer.Application")
ie.Navigate("https://secure.authorize.net/")
# ie.Visible = True
time.sleep(1)
doc = ie.Document
print doc.body.innerHTML
or with a wait function
from win32com.client import Dispatch
import time
def wait(ie):
while ie.Busy:
time.sleep(0.5)
while ie.Document.readyState != "complete":
time.sleep(0.5)
ie = Dispatch("InternetExplorer.Application")
ie.Navigate("https://secure.authorize.net/")
# ie.Visible = True
wait(ie)
doc = ie.Document
print doc.body.innerHTML
Enjoy
Robert Marchetti
More information about the Python-list
mailing list