只有当使用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}范围内。
请帮帮我。
发布于 2017-06-27 20:41:49
当然,我们可以在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发布于 2017-06-27 20:32:11
您可以使用Run Keywords,它将在一个序列中执行所有给定的关键字。
${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发布于 2018-06-06 00:01:48
如果' ${temp} '==' rxu‘,则设置测试变量${temp}rxu运行关键字...运行关键字...登录控制台这是一个...然后登录控制台这是2 ..。否则,运行关键字日志来控制另一个块
每行前的空格应符合python间距准则。
https://stackoverflow.com/questions/44780327
复制相似问题