'Else' 是机器人框架脚本中的保留关键字错误

'Else' is a reserved keyword Error in Robot Framework script

我遇到错误

'Else'是保留关键字

代码片段如下,谁能指导我解决?

   :FOR ${key} IN @{keys}
   \           ${item}= Get From Dictionary ${services} ${key}
   \           Run Keyword If '${item}' == '1' Log Service: ${key} is Running
   \          Else If '${item}' == '2' Log
   \          ... Service: ${key} is not running

您忘记使用连续字符。所有 "else" 和 "elseif" 单词以及其他关键字和参数都必须是 "run keyword if" 关键字的参数。

:FOR ${key} IN @{keys}
\    ${item}= Get From Dictionary ${services} ${key}
\    Run Keyword If    '${item}' == '1' 
\    ...    Log    Service: ${key} is Running
\    ...    Else If    '${item}' == '2' Log
\    ...    Log    Service: ${key} is not running