1.在Run Keyword If語句中
如果有多個判斷語句,可以用小寫 and 或者是 or 連接,具體用 and 還是 or 根據自己程序的情況而定
如果判斷后要執行多個語句
則需要使用大寫 AND 配合 Run Keywords 使用
2、不久又遇到一個問題,我if 條件后面需要接多個執行語句,還記得當時自己猜測亂寫:run keyword if +條件 log 1 log 2(結果肯定報錯啦),后面沒辦法想出了一個解決辦法是,把多個執行語句封裝成一個關鍵字:run keyword if +條件 +封裝的關鍵字。總感覺肯定還有其他解決辦法,就是查不出來,也沒問到。終於在一個群里問到解決方法:Run Keyword If 1==1 Run Keywords log 1 AND log 2 。可以看到用到了關鍵字Run Keywords和AND來處理。
3. https://www.cnblogs.com/labixinxinyexiangyouxiaobai/articles/12760440.html
4.https://www.cnblogs.com/testlife007/p/5029101.html
5. eg
Run keyword if ${2} == ${2}
... Run Keywords Log to console hello world
... AND Keyword1 Pramas1 Params2
... AND Keyword2 Pramas1 Params2
... AND Keyword3 Pramas1 Params2
... AND Keyword3 Pramas1 Params2
6.
Run KeyWord If
${status} | ${value}= | Run Keyword And Ignore Error | My Keyword |
Run Keyword If | ‘${status}’==’PASS’ | Some Action | arg |
Run Keyword Unless | ‘${status}’==’PASS’ | Another Action | My Keyword |
1.單重條件判斷
${status} | Set Variable | 1 | |
Run Keyword If | ${status} <= 3 | log | “right” |
… | ELSE | log | “error” |

Run Keyword If | ‘${color}’ == ‘Red’ or ‘${size}’ == ‘Small’ or ‘Design’ == ‘Simple’ | log | “right” |
2.多重條件判斷( …ELSE IF … ELSE)
${status} | Set Variable | 1 | ||
Run Keyword If | ${status} < = 3 | log | “right” | |
… | Else If | ${status} > 4 | log | “error” |
… | Else | log | “end” |
3.利用IF關鍵字給變量賦值
${status} | Set Variable | 1 | ||
${result} | Run Keyword If | ${status} <= 3 | Set Variable | “right” |
… | Else | Set Variable | “error” |
${status} | Set Variable | 1 | |
${result} | Set Variable If | ${status} <= 3 | “right” |
4.unless關鍵字
Run Keyword Unless | ‘${color}’ == ‘Red’ or ‘${size}’ == ‘Small’ or ‘Design’ == ‘Simple’ | log | “right” |
5. 結合Python語句使用
${data} | Create Dictionary | 1 | use |
${roleId} | Set Variable | 1 | |
Run Keyword If | “${roleId}” in “${data}” | log | “right” |
… | ELSE | log | “error” |
Run KeyWord and Return Status

${status} | Run Keyword And Return Status | checkbox should be selected | id=checked_box | |
${pageCheckedBox} | Run Keyword If | ‘${status}’ == ‘True’ | Set Variable | True |
… | Else | Set Variable | False |