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