python PAM30 PAMIE

最近需要用python操作ie完成某些任務

首先安裝pywin32

此地址下載:http://down.51cto.com/data/575357

安裝PAM30,由於沒有直接的安裝文件 需要下載壓縮包 然後把壓縮吧解壓至python/Lib/site-package/下

下載地址:http://down.51cto.com/data/575365

 

 

  1. from PAM30 import PAMIE 
  2. ie = PAMIE() 
  3. ie.navigate('http://www.baidu.com') 

獲取某個對象文本

  1. ie.findElement('tag','屬性','屬性值').outerText 

獲取html源碼

  1. ie.outerHTML 

 

 

  1. TextArea 
  2.  
  3.     getTextArea (name):    獲取一個textarea,可能使用 id,name 或者 index 
  4.     getTextAreaValue(name, attribute):   獲取一個textarea的屬性值 
  5.     getTextAreasValue() 獲取所有textarea 
  6.     setTextArea(name): 給textarea賦值 
  7.     textAreaExists(name): 查看指定名稱的textarea 是否存在 
  8.  
  9.  
  10. Input 
  11.  
  12.     getTextBox(name): 
  13.     getTextBoxValue(name, attribute): 
  14.     getTextBoxes(): 
  15.     getTextBoxesValue() 
  16.     setTextBox( name, value): 
  17.     getInputElements(): 
  18.  
  19.  
  20. Button 
  21.  
  22.     buttonExists(self, name):  檢查一個button是否存在 
  23.     clickButton(self, name):   點擊一個按鈕, name 可以是 name,id,index甚至是value屬性的值 
  24.     clickButtonImage(self, name):  同上,點擊一個圖片按鈕 
  25.  
  26.  
  27. Radio 
  28.  
  29.     getRadioButton(name): 
  30.     def getRadioButtonSelected(name): 
  31.     getRadioButtonValues(name): 
  32.     getRadioButtons(): 
  33.  
  34.  
  35. CheckBox 
  36.  
  37.     checkBoxExists(self, name): 檢查一個單選框是否存在 
  38.  
  39.  
  40. ListBox 
  41.  
  42.     getListBox(name): 
  43.     getListBoxItemCount(name): 
  44.     getListBoxOptions(name): 
  45.     getListBoxSelected(name): 
  46.     getListBoxValue(name, attribute): 
  47.     listBoxUnSelect(name, value): 
  48.     selectListBox(name, value): 
  49.  
  50.  
  51. Image 
  52.  
  53.     getImage( name): 
  54.     getImageValue(name, attribute): 
  55.     getImages(): 
  56.     getImagesValue( attribute): 
  57.     imageExists(name): 
  58.  
  59.  
  60. form 
  61.  
  62.     formExists( name): 
  63.     getForm( name=None): 
  64.     getFormValue( name, attribute): 
  65.     getFormVisibleControlNames( name=None): 
  66.     getForms(): 
  67.     getFormsValue( attribute): 
  68.  
  69.  
  70.  
  71.     clickHiddenLink( name): 
  72.     getLink( name): 
  73.     getLinkValue( name, attribute): 
  74.     getLinks( filter=None): 
  75.  
  76.  
  77. table 
  78.  
  79.     getTable( name): 
  80.     getTableData( name): 
  81.     getTableRowIndex( name, row): 
  82.     getTableText(tableName,rownum,cellnum, frameName=None): 
  83.     getTables( filter=None): 
  84.     tableCellExists( tableName, cellText): 
  85.     tableExists( name): 
  86.     tableRowExists( name, row): 
  87.  
  88.  
  89. div 
  90.  
  91.     divExists( name): 
  92.     getDiv( name): 
  93.     getDivValue( name, attribute): 
  94.     getDivs(): 
  95.     getDivsValue( attribute): 
  96.  
  97.  
  98. 通用 Element 
  99.  
  100.     clickElement( element):  點擊一個節點。 
  101.     clickHiddenElement( element): 
  102.     findElement( tag, attributes, val, elementList=None): 
  103.     findElementByIndex( tag, indexNum, filter=NoneelementList=None): 
  104.     findText( text): 
  105.     fireElementEvent( tag, controlName, eventName): 
  106.     textFinder(text): 
  107.     getElementChildren( element, all=True): 
  108.     getElementParent( element): 
  109.     getElementValue( element, attribute): 
  110.     getElementsList( tag, filter=NoneelementList=None): 
  111.  
  112.  
  113. 操作類函數: 
  114.       用於控制IE的動作 
  115.  
  116.     navigate( url): 
  117.     changeWindow( wintext):  轉而控制另外一個窗體對象 
  118.     pause( string = "Click to Continue test"): 
  119.     goBack(self): 
  120.     findWindow( title, indexNum=1): 
  121.     closeWindow( title=None): 
  122.     refresh(self): 
  123.     resize( iWidth, iHeight): 
  124.     quit(self): 
  125.  
  126. 信息資源類: 
  127.        獲取當前IE的屬性 
  128.  
  129.     getIE(self): 
  130.     getPageText(self): 
  131.     locationURL(self): 
  132.     outerHTML(self): 
  133.     randomString( length): 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章