循环等待某个文本在页面出现,循环xx次。
wait4text
[Arguments] ${text} ${xx}
FOR ${celldata} IN RANGE ${xx}
${status} Run Keyword And Return Status page should contain text ${text}
run keyword if ${status}==False sleep 2
... ELSE Exit For Loop
END
[Return] ${status}
Appium判断二种元素出来一种即可继续,例如:如果弹出提示则点击提示,如果页面显示某字符则不需要等待弹框。
循环等待其中一个文本
[Arguments] ${text} ${text2} ${xx}
FOR ${celldata} IN RANGE ${xx}
sleep 2
${status1} Run Keyword And Return Status page should contain text ${text}
${status2} Run Keyword And Return Status page should contain text ${text2}
run keyword if ${status1}==True Exit For Loop
run keyword if ${status2}==True Exit For Loop
END
Return From Keyword If ${status1}==True 1
Return From Keyword If ${status2}==True 2
Return From Keyword 0
下面是调用的例子
test
sleep 2
click element ${kongjianku['home']}
Wait Until Page Contains 首页 5
click element ${kongjianku['page_action1']}
Wait Until Page Contains 页面信息 5
click element ${kongjianku['page_action2']}
${dzckcxstatus} wait4test 温馨提示 10
run keyword if ${dzckcxstatus}==True click element //*[@text="确定"]
sleep 2
click element ${kongjianku['page_action3']}
Wait Until Page Contains 页面2信息 5
click element ${kongjianku['page_action4']}
${jpckcxstatus} wait4tests 温馨提示 起始号码 10
run keyword if ${jpckcxstatus}==1 click element //*[@text="重试"]
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。