处理 Run Keyword If 中的多个语句 - Robot Framework

2 selenium robotframework

仅当使用 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
Run Code Online (Sandbox Code Playgroud)

我不知道如何捆绑的所有语句click element的范围之内Run Keyword If ${isElementExist}

请帮助我。

B.B*_*dan 5

课外我们可以执行多条语句 Run Keyword If

If 语句应该是

Run Keyword If    ${isElementExist}    Run Keywords    click element      id=btn1
...   AND    click element      id=btn2
...   AND    click element      id=btn3
Run Code Online (Sandbox Code Playgroud)

完整的代码是

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