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

最新文章

  1. design包 TabLayout使用
  2. VS Code 相关
  3. SharePoint Server 2016 Update
  4. 二、 显示加载数据过程的JS
  5. Hibernate框架配置
  6. ASP.NET Session丢失的情况
  7. 使用MyBatis的resultMap高级查询时常用的方式总结
  8. 用java写bp神经网络(三)
  9. WampServer下如何实现多域名配置
  10. Nimbus<三>Storm源码分析--Nimbus启动过程
  11. centos7修改网卡名字为传统名字
  12. 第五节:从源码的角度理解各种Result(ActionResult、JsonResult、JavaScriptResult等)
  13. 用交叉验证改善模型的预测表现-着重k重交叉验证
  14. 全面解读第四代基因测序技术Oxford Nanopore--转载
  15. React项目中使用HighCharts
  16. windows 查看链接数
  17. Linux cut命令用法
  18. 使用 GCD 实现倒计时效果
  19. excel如何快速更改表格边框的颜色
  20. Java如何处理空堆栈异常?

热门文章

  1. HASH算法具体解释
  2. ALERT日志中常见监听相关报错之二:ORA-3136错误的排查
  3. Opencv分水岭算法——watershed自动图像分割用法
  4. node-sass的安装问题
  5. [ES7] Convert Any Function into an Asynchronous Function
  6. 使用LAMP创建基于wordpress的个从博客网站 分类: B3_LINUX 2014-07-15 16:45 800人阅读 评论(0) 收藏
  7. Docker入门之 - 如何安装Docker CE
  8. 【u006】海战
  9. Matlab矩阵基础
  10. Linux非图形界面安装程序