RobotFramework中使用Exit For Loop If退出For循環


 

要實現:

每隔1秒獲取一次Static1的text,發現不為空或重復100次后則退出循環

 

在User Guide中找到Exit For Loop If關鍵字:

Exit For Loop If condition

Stops executing the enclosing for loop if the condition is true.

A wrapper for Exit For Loop to exit a for loop based on the given condition. The condition is evaluated using the same semantics as with Should Be True keyword.

Example:

FOR ${var} IN @{VALUES}
  Exit For Loop If '${var}' == 'EXIT'  
  Do Something ${var}  
END      

 

示例如下:

:FOR    ${i}    IN RANGE   0    100
\    ${info}=    Control get text    page1    ${EMPTY}    Static1
\    Exit For Loop If    '${info}' != ''
\    sleep    1

 


免責聲明!

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



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