如何在Robot Framework中使用OR条件?

Ume*_*esh 2 if-statement robotframework

如果其中一个条件成立,我需要检查将要通过的条件.

像我想要使用的关键字如下:

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
Run Code Online (Sandbox Code Playgroud)

使用的运行关键字如果但它不起作用

omb*_*e42 6

您可以使用|连接XPath结果集 做一个等同于OR的东西.

${count}    Get Matching Xpath Count    //div[@prop='value'|//table[@id='bar']|//p
Run Keyword If    ${count} > 0    Some Keyword
Run Code Online (Sandbox Code Playgroud)

如果您只是想要失败,如果找不到任何XPath:

Page Should Contain Element    xpath=//div[@prop='value'|//table[@id='bar']|//p
Run Code Online (Sandbox Code Playgroud)