国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

Python自動調用IE打開某個網站的方法

瀏覽:5日期:2022-08-07 18:46:02

本文實例講述了Python自動調用IE打開某個網站的方法。分享給大家供大家參考。具體實現方法如下:

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.jb51.net") pythoncom.PumpMessages() ie.Quit()

運行該程序可打開www.jb51.net網站,同時輸出如下結果:

DownloadBegintestDownloadCompleteDownloadBegintestDownloadCompletedocumentComplete of http://pos.baidu.com/acomadn=0ltr=&cf=u2DownloadBegintestDownloadComplete

希望本文所述對大家的Python程序設計有所幫助。

您可能感興趣的文章:

python實現的重啟關機程序實例

python實現自動登錄人人網并采集信息的方法

python自動zip壓縮目錄的方法

python實現自動更換ip的方法

Python自動重試HTTP連接裝飾器

python定時檢查某個進程是否已經關閉的方法

python關閉windows進程的方法

python實現自動重啟本程序的方法

標簽: Python 編程
相關文章:
主站蜘蛛池模板: 澄迈县| 商南县| 沽源县| 垦利县| 黔江区| 怀安县| 德化县| 五大连池市| 利川市| 呈贡县| 营山县| 兰州市| 和政县| 宜城市| 大理市| 安远县| 信丰县| 隆化县| 泰兴市| 沂源县| 大理市| 府谷县| 遵义市| 嘉善县| 万州区| 通海县| 长垣县| 鄂尔多斯市| 理塘县| 河曲县| 枣强县| 晋州市| 文昌市| 岢岚县| 固安县| 金门县| 交口县| 兰西县| 泰和县| 桃源县| 鸡西市|