文章詳情頁
Python自動調(diào)用IE打開某個網(wǎng)站的方法
瀏覽:9日期:2022-08-07 18:46:02
本文實(shí)例講述了Python自動調(diào)用IE打開某個網(wǎng)站的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
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()運(yùn)行該程序可打開www.jb51.net網(wǎng)站,同時輸出如下結(jié)果:
DownloadBegintestDownloadCompleteDownloadBegintestDownloadCompletedocumentComplete of http://pos.baidu.com/acomadn=0ltr=&cf=u2DownloadBegintestDownloadComplete希望本文所述對大家的Python程序設(shè)計有所幫助。
您可能感興趣的文章:python實(shí)現(xiàn)的重啟關(guān)機(jī)程序?qū)嵗?/p>
python實(shí)現(xiàn)自動登錄人人網(wǎng)并采集信息的方法
python自動zip壓縮目錄的方法
python實(shí)現(xiàn)自動更換ip的方法
Python自動重試HTTP連接裝飾器
python定時檢查某個進(jìn)程是否已經(jīng)關(guān)閉的方法
python關(guān)閉windows進(jìn)程的方法
python實(shí)現(xiàn)自動重啟本程序的方法
相關(guān)文章:
1. XML在語音合成中的應(yīng)用2. HTTP協(xié)議常用的請求頭和響應(yīng)頭響應(yīng)詳解說明(學(xué)習(xí))3. 不要在HTML中濫用div4. ASP將數(shù)字轉(zhuǎn)中文數(shù)字(大寫金額)的函數(shù)5. .NET Framework各版本(.NET2.0 3.0 3.5 4.0)區(qū)別6. jscript與vbscript 操作XML元素屬性的代碼7. HTML5實(shí)戰(zhàn)與剖析之觸摸事件(touchstart、touchmove和touchend)8. php使用正則驗(yàn)證密碼字段的復(fù)雜強(qiáng)度原理詳細(xì)講解 原創(chuàng)9. ASP基礎(chǔ)入門第四篇(腳本變量、函數(shù)、過程和條件語句)10. XML入門的常見問題(三)
排行榜
