只有在使用 Robot Framework 传递条件时,我才需要执行多个语句
请看代码:注意这是一个示例代码
*** Settings ***
Library Selenium2Library
Library Collections
*** Keywords ***
Parent Routine
${isElementExist} Run Keyword And Return Status Element Should Be Visible id=txt1
Run Keyword If ${isElementExist} click element id=btn1
Run Keyword If ${isElementExist} click element id=btn2
Run Keyword If ${isElementExist} click element id=btn3
*** Test Cases ***
Sample Test Case
[Documentation] Simple test for If Condition
Parent Routine
我不知道如何将click element
的所有语句捆绑在Run Keyword If ${isElementExist}
的范围内。
请帮助我。
最佳答案
当然我们可以在 Run Keyword If
中执行多个语句
If 语句应该是
Run Keyword If ${isElementExist} Run Keywords click element id=btn1
... AND click element id=btn2
... AND click element id=btn3
完整代码为
*** Settings ***
Library Selenium2Library
Library Collections
*** Keywords ***
Parent Routine
${isElementExist} Run Keyword And Return Status Element Should Be Visible id=txt1
Run Keyword If ${isElementExist} Run Keywords click element id=btn1
... AND click element id=btn2
... AND click element id=btn3
*** Test Cases ***
Sample Test Case
[Documentation] Simple test for If Condition
Parent Routine
关于selenium - 在 Run Keyword If - Robot Framework 中处理多个语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44780327/