您的位置:首页 > 运维架构 > 网站架构

自动调用IE打开某一个网站

2012-10-26 15:26 232 查看
import win32gui
import win32com
import win32com.client
import pythoncom
import time

class Test:
def runtest(self):
print 'test'

class EventHandler:
def OnVisible(self,visible):
global bVisibleEventFired
bVisibleEventFired = 1
def OnDownloadBegin(self):
print 'DownloadBegin'
self.runtest()
self.value = 1
def OnDownloadComplete(self):
print 'DownloadComplete'
self.value += 1
def OnDocumentComplete(self,pDisp=pythoncom.Missing,URL=pythoncom.Missing):
print 'documentComplete of %s' %URL
print self.value

class H(Test,EventHandler):
pass

ie = win32com.client.DispatchWithEvents('InternetExplorer.Application',H)
ie.Visible = 1
ie.Navigate("www.eotao.com")
pythoncom.PumpMessages()
ie.Quit()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: