十七、RF中的等待時間


1.sleep:強制等待n秒

  sleep  秒數

 

2.implicit wait 隱式等待

  2.1 get selenium implicit wait  :取隱式等待時間,隱式等待時間默認為0

 

 

  2.2 set selenium implicit wait  :設置隱式等待時間

     2.2.1 通過查看源碼,Selenium2Library的implicit_wait默認值為0,所以在引入Selenium2Library時就可以設置implicit_wait時間,而且是全局使用;

    2.2.2 當然這個全局是指要一起運行,簡單來說就是比如你再suite1中引入了Selenium2Library並且設置了implicit_wait時間,要想在suite2中也達到這樣的效果,就要suite1與suite2一起運行,單獨運行suite2是不生效的, 因為沒有實例化suite1中引入的Selenium2Library庫,就是沒有編譯過根本不會執行生效。

3.speed:運行速度(使用同implicit wait)

  3.1 get selenium speed :獲取運行速度

  3.2 set selenium speed:設置運行速度

4.timeout全局超時時間

  4.1 get selenium timeout :默認超時時間為5s

 

 

  4.2 set selenium timeout :設置超時時間

 

 

5. 等待關鍵字與timeout

  5.1 以下五個關鍵字:非必填項,若既設置了全局timeout  又設置了 局部timeout   采用就近原則

Wait Until Element Contains                 Arguments:[ locator | text | timeout=None | error=None ]         等待元素匹配    

Wait Until Element Is Enabled              Arguments:[ locator | timeout=None | error=None]                    等待元素可用
Wait Until Element Is Visible                 Arguments:[ locator | timeout=None | error=None]                   等待元素可見
Wait Until Page Contains                     Arguments:[text | timeout=None | error=None ]                        等待頁面內容匹配
Wait Until Page Contains Element       Arguments:[ locator | timeout=None | error=None]                    等待頁面元素匹配


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM