Selenium IDE web自動化常用命令

Selenium IDE command命令 三大類型:(action、Accessor、assertion)   操作  存儲  斷言  web自動化常用命令

  • 操作類型——Action
    1. 瀏覽器操作
    2. open(https://www.sogou.com/)  打開url。
    3. goBack()  無參數,後退。
    4. refresh()  無參數,刷新。
    5. windowFocus()  無參數,激活選中的瀏覽器窗口。
    6. windowMaximize()  無參數,使瀏覽器窗口最大化。
    7. close() 無參數,關閉。
    8. type("locator","value") 在input表達輸入值。  
    9. typeKeys("locator","value")  模擬鍵盤敲擊,輸入字符。
    10. click("locator")  單擊,最後後面使用waitForPageToLoad()命令。
    11. clickAt("locator","coordstring") 單擊,需要提供想的座標。
    12. doubleClick("locator")  雙擊。
    13. doubleClickAt("locator","coordstring") 雙擊。
    14. select("locator")  在下拉框中選擇選項。
    15. selectWindow("windowID") 選取窗口,如果參數爲null,則選擇舊彈窗
    16. selectPopUp("windowID")  無參數,表示選擇彈出窗口;參數可以是新窗口的名字、標題。。

    17. check("locator")  勾選複選框或單選框。
    18. uncheck("locator")  取消勾選。
    19. focus("locator")  定位焦點。
    20. setTimeout("timeout/ms")等待超時時間。
    21. setSpeed("time/ms")  測試執行速度。
    22. pause(""time/ms" )  暫停時間。
    23. break()無參數,暫停當前測試,除非手動繼續。
    24. captureEntirePageScreenshot("filename")  截圖並保存爲PNG文件。需要指明路徑和文件後綴。
    25. highlight("locator")將元素背景色改爲黃色。
    26. echo("massage")  打印靜態信息。
    27. echo ${a}   打印動態變量的值。
    •   存儲類型——Accessor  檢查應用程序的狀態,並將結果存入變量。 其中locate爲定位元素。如name=wd
      1. store("值",“variableName”)將值存入變量。  打印出該值,echo ${變量}    
      2. storeTitle("title")將當前網頁標題存入變量title。   echo ${title}    
      3. storeLocation("url")將網頁URL存入變量。  echo ${url}    
      4. storeValue("locate","variableName")將input元素存入變量。echo ${變量}    
      5. storeEditable("locate","variableName")將input元素的可編輯狀態存入變量。可編輯返回true。echo ${變量}    
      6. storeText("locate","variableName")將元素的文本值存入變量。echo ${變量}    
      7. storeChecked("locate","variableName")將選框的勾選狀態存入變量。已勾選返回true。echo ${變量}    
      8. storeSelectedIndex("locate","variableName")將下列列表中index存入變量。echo ${變量}    
      9. storeSelectedLable("locate","variableName")    
      10. storeSelectedValue("locate","variableName")    
      11. storeSelectedOptions("locate","variableName")
      12. storeTable("locate","variableName")    
      13. storeAttibute("locate","variableName")    
      14. storeTextPresent("locate","variableName")    
      15. storeElementPresent("locate","variableName")將元素存在頁面中是否存入變量。    
      16. storeVisible("locate","variableName")將元素的可見性存入變量。    
      17. storeSpeed("variableName") 將執行速度存入變量。  
    • 斷言類型——Assertion 驗證某個命題是否爲真。網頁標題、URL、input元素值、
      1. assertTitle("預期值")驗證網頁的標題是否等於預期值。
      2. assertNoTitle("預期值")驗證網頁的標題是否不等於預期值。
      3. verifyTitle("預期值")         同assertTitle功能一樣
      4. verifyNotTitle("預期值")   同assertNotTitle功能一樣
      5. waitForTitle("預期值")      等待當前網頁標題並進行驗證是否等於預期值
      6. waitForNotTitle("預期值")等待當前網頁標題並進行驗證是否不等於預期值
      7. assertLacation("url")        驗證網頁的URl是否等於預期值
      8. assertNotLocation("url")驗證網頁的URl是否不等於預期值
      9. verifyLocation("url")
      10. verifyNotLocation("url")
      11. waitForLocation("url")
      12. waitForNotLocation("url")
      13. assertValue("locate","預期值")驗證input元素的值是否等於預期值
      14. assertNotValue("locate","預期值")
      15. verifyValue("locate","預期值")
      16. verifyNotValue("locate","預期值")
      17. waitForValue("locate","預期值")
      18. waitForNotValue("locate","預期值")
      19. assertEditable()
      20. assertText("locate","預期值")驗證某個元素的文本值是否等於預期值。
      21. assertNotText("locate","預期值")
      22. verifyText("locate","預期值")
      23. verifyNotText("locate","預期值")
      24. waiForText("locate","預期值")
      25. waitForNotText("locate","預期值")
      26. assertChecked()

 

 

 

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