Selenium 在Run关键字If-Robot框架中处理多个语句
只有在使用Robot框架传递条件时,我才需要执行多个语句 请看代码:注意这是一个示例代码Selenium 在Run关键字If-Robot框架中处理多个语句,selenium,robotframework,Selenium,Robotframework,只有在使用Robot框架传递条件时,我才需要执行多个语句 请看代码:注意这是一个示例代码 *** Settings *** Library Selenium2Library Library Collections *** Keywords *** Parent Routine ${isElementExist} Run Keyword And Return Status Element Should Be Visible id=txt1 Run Ke
*** 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
如果${isElementExist},我不知道如何将click元素的所有语句捆绑在Run关键字的范围下
请帮助我。您可以使用运行关键字
,它将按顺序执行所有给定的关键字
${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
当然,如果
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
设置测试变量${temp}rxu
如果“${temp}”==“rxu”,则运行关键字
... 运行关键字
... 登录到控制台这是一个
... 并登录到控制台这是两个
... 否则,运行关键字日志以控制台另一个块
每行前的间距应符合python间距指南