Refreshing an IE Webpage

K-Dawg kdawg44 at
Mon Feb 2 12:05:39 EST 2009

I have also tried to do this with mechanize:

import mechanize
import time

br = mechanize.Browser()"URL")
while True:

After a bunch of time, I get the following error:
Traceback (most recent call last):
 File "C:\",
line 1
1, in <module>

"C:\Python25\lib\site-packages\mechanize-0.1.9-py2.5.egg\mechanize\_mecha", line 345, in reload
"C:\Python25\lib\site-packages\mechanize-0.1.9-py2.5.egg\mechanize\_mecha", line 257, in _mech_open
mechanize._response.httperror_seek_wrapper: HTTP Error 302: The HTTP server
rned a redirect error that would lead to an infinite loop.
The last 30x error message was:

And on my first code, trying to use the Win32 api, I get the following

Traceback (most recent call last):
 File "C:\",
line 8,
in <module>
pywintypes.com_error: (-2147352570, 'Unknown name.', None, None)

All I want to do is grab a page and refresh it every 5 minutes.



On Mon, Feb 2, 2009 at 9:14 AM, K-Dawg <kdawg44 at> wrote:

> 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: <>

More information about the Python-list mailing list