久久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 編程
相關文章:
主站蜘蛛池模板: 巴彦淖尔市| 砚山县| 西贡区| 栾城县| 平顶山市| 从化市| 新建县| 南召县| 锡林郭勒盟| 广德县| 邢台市| 和龙市| 绍兴县| 沙田区| 牙克石市| 西吉县| 广昌县| 深泽县| 隆尧县| 永和县| 井冈山市| 桃江县| 盐边县| 涿鹿县| 铜山县| 揭西县| 台湾省| 武鸣县| 滕州市| 永清县| 镇原县| 贵阳市| 上思县| 延寿县| 汪清县| 简阳市| 丽水市| 舟曲县| 牙克石市| 隆安县| 家居|