本文介绍了如何在Robot Framework中使用OR条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果其中一个条件成立,我需要检查将要通过的条件。
I am in need to check the condition that is going to be passed if one of the conditions being true.
我想要使用的关键字如下所示:
The Keywords like I want to use is as below:
Page Should Contains Element //some xpath OR
Page Should Contains Element //some xpath OR
Page Should Contains Element //some xpath OR
Page Should Contains Element //some xpath
使用运行关键字如果但它不能正常工作
推荐答案
您可以将XPath结果集与|执行相当于OR的操作。
You can join XPath result sets with the | to do what is equivalent to an OR.
${count} Get Matching Xpath Count //div[@prop='value'|//table[@id='bar']|//p
Run Keyword If ${count} > 0 Some Keyword
如果您只是想要失败,如果找不到任何XPath:
If you just want to fail if none of the XPaths are found:
Page Should Contain Element xpath=//div[@prop='value'|//table[@id='bar']|//p
这篇关于如何在Robot Framework中使用OR条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!