How python automatically calls ie to open a Web site

Source: Internet
Author: User
This example describes how Python automatically calls ie to open a Web site. Share to everyone for your reference. The implementation method is as follows:

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):   
  

Run the program to open the Www.jb51.net Web site and output the following results:

Downloadbegintestdownloadcompletedownloadbegintestdownloadcompletedocumentcomplete of http://pos.baidu.com/acom? Adn=0&at=128&aurl=&cad=1&ccd=32&cec=gb2312&cfv=17&ch=0&col=zh-cn&conop=0 &cpa=1&dai=1&dis=0&layout_filter=rank%2cimage&ltr=&ltu=http%3a%2f%2fwww.jb51.net%2f &lunum=6&n=jb51_cpr&pcs=1387x729&pis=10000x10000&ps=2348x191&psr=1440x900&pss= 1387x2350&qn=6a0cce8cf992d19c&rad=&rsi0=1000&rsi1=60&rsi5=4&rss0=&rss1=&rss2= &rss3=&rss4=&rss5=&rss6=&rss7=&scale=&skin=tabcloud_skin_6&stid=5&td_id= 1919103&tn=baiducuststaglinkunit&tpr=1433304842125&ts=1&version=2.0&xuanting=0&dtm= Baidu_dup2_setjsonadslot&dc=2&di=u1919103&ti=%e8%84%9a%e6%9c%ac%e4%b9%8b%e5%ae%b6_www.jb51.net &tt=1433304842078.47.125.1252documentcomplete of http://www.jb51.net/ 2DownloadBegintestDownloadCompletedocumentComplete of Http://pos. baidu.com/wh/o.htm?ltr=&cf=u2downloadbegintestdownloadcomplete 

Hopefully this article will help you with Python programming.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.