PAMIE是Python下面的用于IE的自动化模块,支持python2和python3,python3的下载地址:http://sourceforge.net/projects/pamie/files/PAMIE/PAM3.0%20for%20Python%203.0/
PAMIE是Python Automated Module for I.E. 的缩写。
 
简单的例子:

# To use Pamie you must first create a new script or text file that you can saveas mytest.py.
# This will import the cPAMIE class file so you can use it's methods
from cPAMIE import PAMIE
# create a new instance of the PAMIE object
ie = PAMIE( )
# Lets navigate to google - this methods takes a string as the URL
ie.Navigate("'www.google.com" )
ie.textBoxSet("q", "python" ) #control name, value
# Now Submit the form.
ie.buttonClick("'btnG" )

但是我们实际使用中,实际上会碰到许多的控件。如,input ,radio ,checkbox.

下面针对不同控件给出函数列表, 大家看名字大概就应该明白是干什么的. 权当手册使用吧,呵呵 :

状态控制
       实际应用中,需要考虑IE的状态,比如访问一个网页,随即进行操作,在网页未下载完成的情况下,容易出错
       PAMIE 则考虑到下面的情况

  1. _wait()  : 等待整个页面下载完成
  2. _frameWait() :  等待一个frame下载完成
  3. _docGetReadyState:  获取文档对象的状态

复制代码

TextArea

  1. getTextArea (name):  获取一个textarea,可能使用 id,name 或者 index
  2. getTextAreaValue(name, attribute):  获取一个textarea的属性值
  3. getTextAreasValue() 获取所有textarea
  4. setTextArea(name): 给textarea赋值
  5. textAreaExists(name): 查看指定名称的textarea 是否存在

复制代码

Input

  1. getTextBox(name):
  2. getTextBoxValue(name, attribute):
  3. getTextBoxes():
  4. getTextBoxesValue()
  5. setTextBox( name, value):
  6. getInputElements():

复制代码

Button

  1. buttonExists(self, name):  检查一个button是否存在
  2. clickButton(self, name):  点击一个按钮, name 可以是 name,id,index甚至是value属性的值
  3. clickButtonImage(self, name):  同上,点击一个图片按钮

复制代码

Radio

  1. getRadioButton(name):
  2. def getRadioButtonSelected(name):
  3. getRadioButtonValues(name):
  4. getRadioButtons():

复制代码

CheckBox

  1. checkBoxExists(self, name): 检查一个单选框是否存在

复制代码

ListBox

  1. getListBox(name):
  2. getListBoxItemCount(name):
  3. getListBoxOptions(name):
  4. getListBoxSelected(name):
  5. getListBoxValue(name, attribute):
  6. listBoxUnSelect(name, value):
  7. selectListBox(name, value):

复制代码

Image

  1. getImage( name):
  2. getImageValue(name, attribute):
  3. getImages():
  4. getImagesValue( attribute):
  5. imageExists(name):

复制代码

form

  1. formExists( name):
  2. getForm( name=None):
  3. getFormValue( name, attribute):
  4. getFormVisibleControlNames( name=None):
  5. getForms():
  6. getFormsValue( attribute):

复制代码

a

  1. clickHiddenLink( name):
  2. getLink( name):
  3. getLinkValue( name, attribute):
  4. getLinks( filter=None):

复制代码

table

  1. getTable( name):
  2. getTableData( name):
  3. getTableRowIndex( name, row):
  4. getTableText(tableName,rownum,cellnum, frameName=None):
  5. getTables( filter=None):
  6. tableCellExists( tableName, cellText):
  7. tableExists( name):
  8. tableRowExists( name, row):

复制代码

div

  1. divExists( name):
  2. getDiv( name):
  3. getDivValue( name, attribute):
  4. getDivs():
  5. getDivsValue( attribute):

复制代码

通用 Element

  1. clickElement( element):  点击一个节点。
  2. clickHiddenElement( element):
  3. findElement( tag, attributes, val, elementList=None):
  4. findElementByIndex( tag, indexNum, filter=None, elementList=None):
  5. findText( text):
  6. fireElementEvent( tag, controlName, eventName):
  7. textFinder(text):
  8. getElementChildren( element, all=True):
  9. getElementParent( element):
  10. getElementValue( element, attribute):
  11. getElementsList( tag, filter=None, elementList=None):

复制代码

操作类函数:
      用于控制IE的动作

  1. navigate( url):
  2. changeWindow( wintext):  转而控制另外一个窗体对象
  3. pause( string = "Click to Continue test"):
  4. goBack(self):
  5. findWindow( title, indexNum=1):
  6. closeWindow( title=None):
  7. refresh(self):
  8. resize( iWidth, iHeight):
  9. quit(self):

复制代码

信息资源类:
       获取当前IE的属性

  1. getIE(self):
  2. getPageText(self):
  3. locationURL(self):
  4. outerHTML(self):
  5. randomString( length):

复制代码

最后给大家奉上 Win32Com, PAM30

python3下的IE自动化模块PAMIE的更多相关文章

  1. 企业环境下的OpenStack自动化功能测试(转载)

    原文地址:http://mp.weixin.qq.com/s?__biz=MzAxOTAzMDEwMA==&mid=2652502581&idx=1&sn=0c26519bcb ...

  2. CentOS 下运维自动化 Shell 脚本之 expect

    CentOS 下运维自动化 Shell脚本之expect 一.预备知识: 1.在 Terminal 中反斜杠,即 "" 代表转义符,或称逃脱符.("echo -e与pri ...

  3. selenium中的下拉框处理模块Select

    在UI自动化测试过程中,经常会遇到一些下拉框,如果我们基于Webdriver操作的话就需要click两次,而且很容易出现问题,实际上Selenium给我们提供了专门的Select(下拉框处理模块). ...

  4. python3下django连接mysql数据库

    1.安装pymysql pip install pymysql 有一点需要注意,有的系统(比如ubuntu16.04)同时安装了python2和python3,而比较新的django需要在python ...

  5. Python3.x:os.path模块

    Python3.x:os.path模块 #返回绝对路径 os.path.abspath(path) #返回文件名 os.path.basename(path) #返回list(多个路径)中,所有pat ...

  6. 在python3下用PIL做图像处理

    Python Imaging Library (PIL)是python下的图像处理模块,支持多种格式,并提供强大的图形与图像处理功能. 目前PIL的官方最新版本为1.1.7,支持的版本为python ...

  7. Jenkins下构建UI自动化之初体验

    一.缘 起 笔者之前一直在Windows环境下编写UI自动化测试脚本,近日在看<京东系统质量保障技术实战>一书中,萌生出在jenkins下构建UI自动化测试的想法 二.思 路 首先,在Li ...

  8. Python3学习笔记(urllib模块的使用)转http://www.cnblogs.com/Lands-ljk/p/5447127.html

    Python3学习笔记(urllib模块的使用)   1.基本方法 urllib.request.urlopen(url, data=None, [timeout, ]*, cafile=None,  ...

  9. Python3下map函数的显示问题

    map函数是Python里面比较重要的函数,设计灵感来自于函数式编程.Python官方文档中是这样解释map函数的: map(function, iterable, ...) Return an it ...

随机推荐

  1. linux 安装完mysql 密码重置

    If you have forgot the MySQL root password, can’t remember or want to break in….. you can reset them ...

  2. SetForegroundWindow的正确用法

    在SetForegroundWindow之前比较早的时候(比如main函数里)调用一下以下代码: DWORD dwTimeout = -1; SystemParametersInfo(SPI_GETF ...

  3. [转载]MVC中单用户登录

    转自:http://www.cnblogs.com/firstcsharp/archive/2013/05/19/3087481.html 把下面这段代码放在登录用户验证以后:   //用户登录验证通 ...

  4. Swift之动画总结

    UIView动画个人笔记,代码简单,不过多赘述.1.定义三个View @IBOutlet weak var mFirstView: UIView! @IBOutlet weak var mSecond ...

  5. Intellij IDEA中使用Debug

    Intellij IDEA中使用Debug Debug用来追踪代码的运行流程,通常在程序运行过程中出现异常,启用Debug模式可以分析定位异常发生的位置,以及在运行过程中参数的变化.通常我们也可以启用 ...

  6. WordPress的后台功能菜单介绍与操作,WordPress后台说明

    WordPress网站的后台概况和登陆地址 网站都有个后台管理系统,通过网站后台,你可以改变你的网站外观,管理你网站的数据,给网站前台增加页面,文章,视频,图片或者其他功能. 通过WordPress建 ...

  7. jquery-4 完整表单验证实例

    jquery-4 完整表单验证实例 一.总结 一句话总结:在form的jquery对象中返回false即可终止表单提交. 1.验证的显示错误消息如何布局? 开始时隐藏,出现错误后显示 10 .erro ...

  8. [Node.js] Build microservices in Node.js with micro

    micro is a small module that makes it easy to write high performance and asynchronous microservices ...

  9. Java环境搭建若干问题

    0.总体说明   本次搭建环境,为了偷懒,使用的是,阿里云镜像.   自带了Nginx.Tomcat.JDK等.   比较坑爹的是,虽然镜像带了很多安装好的软件,但是也有各种问题,比如它修改了tomc ...

  10. Haproxy解析

    简单介绍 HAProxy是一款提供高可用性.负载均衡以及基于TCP和HTTP应用的代理软件,HAProxy是全然免费的.借助HAProxy能够高速而且可靠的提供基于TCP和HTTP应用的代理解决方式. ...