python3下的IE自动化模块PAMIE
2011-12-17 16:10
495 查看
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. 的缩写。
简单的例子:
但是我们实际使用中,实际上会碰到许多的控件。如,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
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
相关文章推荐
- python3下的IE自动化模块PAMIE
- python3下的IE自动化模块PAMIE
- python3下的IE自动化模块PAMIE
- 转:PAMIE- Python实现IE自动化的模块
- PAMIE- Python实现IE自动化的模块
- PAMIE- Python实现IE自动化的模块
- PAMIE的全称是Python Automated Module For Internet Explorer,顾名思义,PAMIE是一个实现IE自动化的模块
- PAMIE- Python实现IE自动化的模块
- PAMIE- Python实现IE自动化的模块
- PAMIE- Python实现IE自动化的模块
- PAMIE- Python实现IE自动化的模块
- Python PAMIE模块实现IE自动化
- 转:PAMIE- Python实现IE自动化的模块
- PAMIE- Python实现IE自动化的模块(附 网易注册代码)
- 转:PAMIE- Python实现IE自动化的模块(附 网易注册代码)
- PAMIE- Python实现IE自动化的模块
- python IE自动化模块(模拟操作IE)
- python使用Fabric模块实现自动化运维
- Python运维自动化开发之Fabric模块
- Python自动化运维之常用模块—configparser