关键字Wait Until Keyword Succeeds

Name:
Wait Until Keyword Succeeds
Source:
指定的时间retry内,每间隔指定个的时间retry_interval,尝试执行指定的关键字
关键字执行成功,就停止尝试
关键字在retry时间后,一直未成功,停止尝试,也不执行后面语句

Arguments:
[ retry | retry_interval | name | *args ]
Retry指定尝试的时间内,但是s
retry_interval 尝试的间隔时间,如2s 表示每2s尝试一次
name关键字名称
args为name关键字的参数

例如1:尝试判断百度首页是否有text “设为1首页”,执行失败

log    我的日志
should be equal    1    1
open browser    https://www.baidu.com    chrome
Wait Until Keyword Succeeds    10s    2s    Wait Until page contains    设为1首页    3    nofound
log    你的日志

ride执行结果如下:
20200331 14:00:16.390 : INFO : 我的日志
20200331 14:00:16.391 : INFO : Opening browser ‘chrome’ to base url ‘https://www.baidu.com’.
20200331 14:00:23.050 : INFO :
20200331 14:00:23.052 : FAIL : nofound
20200331 14:00:28.628 : INFO :
20200331 14:00:28.629 : FAIL : nofound
20200331 14:00:34.142 : INFO :
20200331 14:00:34.144 : FAIL : nofound
20200331 14:00:34.144 : FAIL : Keyword ‘Wait Until page contains’ failed after retrying for 10 seconds. The last error was: nofound

例如2:尝试判断百度首页是否有text “设为首页”,执行成功

log    我的日志
should be equal    1    1
open browser    https://www.baidu.com    chrome
Wait Until Keyword Succeeds    10s    2s    Wait Until page contains    设为首页    3    nofoun

log 你的日志

ride中的执行结果
20200331 14:01:47.145 : INFO : 我的日志
20200331 14:01:47.146 : INFO : Opening browser ‘chrome’ to base url ‘https://www.baidu.com’.
20200331 14:01:50.180 : INFO : 你的日志
Ending test: 氚云 webUI自动化.氚云2.0冒烟.00 公共.00 公共.我的用例

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值