python3下的IE自动化模块PAMIE
2024-10-01 23:52:05
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 则考虑到下面的情况
- _wait() : 等待整个页面下载完成
- _frameWait() : 等待一个frame下载完成
- _docGetReadyState: 获取文档对象的状态
复制代码
TextArea
- getTextArea (name): 获取一个textarea,可能使用 id,name 或者 index
- getTextAreaValue(name, attribute): 获取一个textarea的属性值
- getTextAreasValue() 获取所有textarea
- setTextArea(name): 给textarea赋值
- textAreaExists(name): 查看指定名称的textarea 是否存在
复制代码
Input
- getTextBox(name):
- getTextBoxValue(name, attribute):
- getTextBoxes():
- getTextBoxesValue()
- setTextBox( name, value):
- getInputElements():
复制代码
Button
- buttonExists(self, name): 检查一个button是否存在
- clickButton(self, name): 点击一个按钮, name 可以是 name,id,index甚至是value属性的值
- clickButtonImage(self, name): 同上,点击一个图片按钮
复制代码
Radio
- getRadioButton(name):
- def getRadioButtonSelected(name):
- getRadioButtonValues(name):
- getRadioButtons():
复制代码
CheckBox
- checkBoxExists(self, name): 检查一个单选框是否存在
复制代码
ListBox
- getListBox(name):
- getListBoxItemCount(name):
- getListBoxOptions(name):
- getListBoxSelected(name):
- getListBoxValue(name, attribute):
- listBoxUnSelect(name, value):
- selectListBox(name, value):
复制代码
Image
- getImage( name):
- getImageValue(name, attribute):
- getImages():
- getImagesValue( attribute):
- imageExists(name):
复制代码
form
- formExists( name):
- getForm( name=None):
- getFormValue( name, attribute):
- getFormVisibleControlNames( name=None):
- getForms():
- getFormsValue( attribute):
复制代码
a
- clickHiddenLink( name):
- getLink( name):
- getLinkValue( name, attribute):
- getLinks( filter=None):
复制代码
table
- getTable( name):
- getTableData( name):
- getTableRowIndex( name, row):
- getTableText(tableName,rownum,cellnum, frameName=None):
- getTables( filter=None):
- tableCellExists( tableName, cellText):
- tableExists( name):
- tableRowExists( name, row):
复制代码
div
- divExists( name):
- getDiv( name):
- getDivValue( name, attribute):
- getDivs():
- getDivsValue( attribute):
复制代码
通用 Element
- clickElement( element): 点击一个节点。
- clickHiddenElement( element):
- findElement( tag, attributes, val, elementList=None):
- findElementByIndex( tag, indexNum, filter=None, elementList=None):
- findText( text):
- fireElementEvent( tag, controlName, eventName):
- textFinder(text):
- getElementChildren( element, all=True):
- getElementParent( element):
- getElementValue( element, attribute):
- getElementsList( tag, filter=None, elementList=None):
复制代码
操作类函数:
用于控制IE的动作
- navigate( url):
- changeWindow( wintext): 转而控制另外一个窗体对象
- pause( string = "Click to Continue test"):
- goBack(self):
- findWindow( title, indexNum=1):
- closeWindow( title=None):
- refresh(self):
- resize( iWidth, iHeight):
- quit(self):
复制代码
信息资源类:
获取当前IE的属性
- getIE(self):
- getPageText(self):
- locationURL(self):
- outerHTML(self):
- randomString( length):
复制代码
最后给大家奉上 Win32Com, PAM30
最新文章
- design包 TabLayout使用
- VS Code 相关
- SharePoint Server 2016 Update
- 二、	显示加载数据过程的JS
- Hibernate框架配置
- ASP.NET Session丢失的情况
- 使用MyBatis的resultMap高级查询时常用的方式总结
- 用java写bp神经网络(三)
- WampServer下如何实现多域名配置
- Nimbus<;三>;Storm源码分析--Nimbus启动过程
- centos7修改网卡名字为传统名字
- 第五节:从源码的角度理解各种Result(ActionResult、JsonResult、JavaScriptResult等)
- 用交叉验证改善模型的预测表现-着重k重交叉验证
- 全面解读第四代基因测序技术Oxford Nanopore--转载
- React项目中使用HighCharts
- windows 查看链接数
- Linux cut命令用法
- 使用 GCD 实现倒计时效果
- excel如何快速更改表格边框的颜色
- Java如何处理空堆栈异常?
热门文章
- HASH算法具体解释
- ALERT日志中常见监听相关报错之二:ORA-3136错误的排查
- Opencv分水岭算法——watershed自动图像分割用法
- node-sass的安装问题
- [ES7] Convert Any Function into an Asynchronous Function
- 使用LAMP创建基于wordpress的个从博客网站 分类: B3_LINUX 2014-07-15 16:45 800人阅读 评论(0) 收藏
- Docker入门之 - 如何安装Docker CE
- 【u006】海战
- Matlab矩阵基础
- Linux非图形界面安装程序