久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

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

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

瀏覽:7日期: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 編程
相關文章:
主站蜘蛛池模板: 长沙县| 裕民县| 沂水县| 永安市| 巴青县| 诸城市| 潞城市| 任丘市| 扎兰屯市| 青州市| 定结县| 高安市| 怀宁县| 南和县| 五家渠市| 南丹县| 社旗县| 巴楚县| 陇南市| 津市市| 沅陵县| 吉木乃县| 南木林县| 福建省| 城固县| 建宁县| 北碚区| 河间市| 睢宁县| 清水县| 衡东县| 通渭县| 民乐县| 瑞丽市| 西和县| 周至县| 武山县| 霍林郭勒市| 莎车县| 息烽县| 金秀|