• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >python > Python自动调用IE打开某个网站的方法

Python自动调用IE打开某个网站的方法

作者: 字体:[增加 减小] 来源:互联网

通过本文主要向大家介绍了python ie,python selenium ie,python 打开ie浏览器,python调用方法,python 类方法调用等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

本文实例讲述了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() 

</div>

运行该程序可打开www.jb51.net网站,同时输出如下结果:

DownloadBegin
test
DownloadComplete
DownloadBegin
test
DownloadComplete
documentComplete 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<r=<u=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.125
2
documentComplete of http://www.jb51.net/
2
DownloadBegin
test
DownloadComplete
documentComplete of http://pos.baidu.com/wh/o.htm?ltr=&cf=u
2
DownloadBegin
test
DownloadComplete

</div>

希望本文所述对大家的Python程序设计有所帮助。

</div>

您可能想查找下面的文章:

  • Python自动调用IE打开某个网站的方法
  • python操作ie登陆土豆网的方法

相关文章

  • windows 10下安装搭建django1.10.3和Apache2.4的方法
  • Python中遇到的小问题及解决方法汇总
  • 解决Python 遍历字典时删除元素报异常的问题
  • python网络编程调用recv函数完整接收数据的三种方法
  • python通过ftplib登录到ftp服务器的方法
  • Python 基础知识之字符串处理
  • go语言计算两个时间的时间差方法
  • 跟老齐学Python之大话题小函数(1)
  • python通过urllib2爬网页上种子下载示例
  • python实现指定字符串补全空格的方法

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • 用Python和MD5实现网站挂马检测程序
    • python从sqlite读取并显示数据的方法
    • python实现合并两个数组的方法
    • Python通过PIL获取图片主要颜色并和颜色库进行对比的方法
    • python实现读取命令行参数的方法
    • 详解python脚本自动生成需要文件实例代码
    • Python网络爬虫出现乱码问题的解决方法
    • Python pickle模块用法实例分析
    • Python实现代码统计工具(终极篇)
    • python获取外网ip地址的方法总结

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有