"M.E.Farmer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I played around with it. > ############################################################################ > import pythoncom > from win32com.client import Dispatch > ############################################################################ > def webbrowser(url=None): > ie = pythoncom.CoCreateInstance("InternetExplorer.Application", > None, > pythoncom.CLSCTX_SERVER, > pythoncom.IID_IDispatch) > ie = Dispatch(ie) > ie.Navigate > if url: > ie.Navigate(url) > ie.Visible = 1 > return ie > ############################################################################ # > import time > w = webbrowser() > w.Navigate('http://www.google.com') > time.sleep(2) > w.Navigate('http://dir.gmane.org/gmane.comp.python.general') > time.sleep(2) > webbrowser('http://groups-beta.google.com/group/comp.lang.python?hl=en&lr=') > webbrowser('http://python.org') > ############################################################################ # > M.E.Farmer >
Noticed your sleep statements... because the response times vary from site to site you might want to use this code: while w.ReadyState != 4: # 4 signals browser has finished loading and is ready... 0=uninitialised; 1=loading; 2=loaded; 3=interactive; 4=complete time.sleep(1) While we're on that subject... if you go further and expose the Document object to work with the contents of the browser, for example... doc = w.Document then you also need to check for document readiness before continuing processing as follows... while w.ReadyState != 4 and doc.readyState != "complete": time.sleep(1) Useful links: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/ifaces/IWebBrowser2/IWebBrowser2.asp http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_document.asp HTH, -- http://mail.python.org/mailman/listinfo/python-list