MSIE6 Python Question
calfdog at yahoo.com
calfdog at yahoo.com
Wed Jun 2 18:19:15 EDT 2004
More information about the Python-list mailing list
Wed Jun 2 18:19:15 EDT 2004
- Previous message (by thread): a question on __slots__ (and example from Nutshell)
- Next message (by thread): MSIE6 Python Question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
r.gable at mchsi.com (Ralph A. Gable) wrote in message news:<22b7fd40.0405231744.50d125f1 at posting.google.com>... > I'm a newbie at this but I need to control MSIE6 using Python. I have > read the O'Reilly win32 python books and got some hints. But I need to > Navigate to a site (which I know how to do) and then I need to get at > the source code for that site inside Python (as when one used the > View|Source drop down window). Can anyone point me to some URLs that > would help out? Or just tell me how to do it? I would be very > grateful. TRY THIS!!!! from win32com.client import DispatchEx import time def wait(ie): # very important!!! you have to wait for each page to load "Given an IE object, wait until the object is ready for input." while ie.Busy: time.sleep(0.1) doc = ie.Document while doc.ReadyState != 'complete': time.sleep(0.1) return doc def ClickLink(ie, mylink): #hrefs = [] for link in ie.Document.links: if link is None: break # needed for browser bug if link.innerText == mylink: link.Click() # Here is what you need ie = DispatchEx('InternetExplorer.Application') ie.Visible = 1 ie.Navigate ('www.python.org') # Some extra wait(ie)# Very important you must wait for document to finish loading ClickLink(ie,'Search') #later #RLM
- Previous message (by thread): a question on __slots__ (and example from Nutshell)
- Next message (by thread): MSIE6 Python Question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list