IF ELSE in robot framework with variables assignment

前端 未结 4 1222
广开言路
广开言路 2021-02-07 11:41

I need to execute some keywords conditionally in robot framework, but I dont know how to do it, it does not work. I tried many options, but I guess I have the \"IF-ELSE\" statem

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-07 12:43

    Based on the below syntax, update your code n check it.

    Syntax for IF-ELSE:

       Run Keyword If    '${Condition}'== 'True'    Run Keywords         
       ...    ELSE    
    

    Syntax for "Set Variable" based on condition:

     ${Status}=    Run Keyword If    '${Condition}'== 'True'    Set Variable        
    

    As per your code in IF part,

    if "bool=true", it will execute only the custom keyword "uncheck all in filter" but not the "Click element" keyword. If you want both the keywords to be executed based on the condition, then use "Run Keywords" keyword as mentioned in IF-ELSE syntax.

提交回复
热议问题