Refreshing an IE Webpage

K-Dawg kdawg44 at gmail.com
Mon Feb 2 09:14:26 EST 2009


Hi,

I am trying to get and then refresh a page in IE with a Python script.  I
just want to get a page, then refresh it every 5 minutes.  Below is the code
I am attempting.  It is erroring out on the
id=ie.Document.Script._oleobj_.GetIDsOfNames('window.location.reload()')
#tried with and without parens - reload & reload()
line.  This is mostly a borrowed script I found.  The script was trying to
call a written function on the page.  I just want to call the build in
reload function to refresh the page.

Thanks for any help.

Kevin


import win32com.client, pythoncom
from time import sleep

ie=win32com.client.Dispatch('internetexplorer.application')
ie.Visible=1
ie.Navigate('URL')
sleep(5)

id=ie.Document.Script._oleobj_.GetIDsOfNames('window.location.reload()')
while True:
    res=ie.Document.Script._oleobj_.Invoke(id, 0, pythoncom.DISPATCH_METHOD,
True)
    sleep(300)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090202/f987ba09/attachment.html>


More information about the Python-list mailing list