如何解决此错误"没有名称的关键字"和"找到"

Rak*_*esh 6 robotframework

当我执行此关键字时,会显示"没有名称的关键字"和"找到的错误".

测试此关键字

[arguments]    ${YearDiff}    ${MonthDiff}

Run Keyword If    ${YearDiff}>=0  and  ${MonthDiff}>=0    Click Element    id=Left_Calendar_Icon

Run Keyword If    ${YearDiff}<=0  and  ${MonthDiff}<=0    Click Element    id=Right_Calendar_Icon
Run Code Online (Sandbox Code Playgroud)

如果我使用了错误的语法,请纠正我.

Bry*_*ley 6

您使用的是以空格分隔的格式,这意味着机器人使用两个或多个空格来分隔关键字."and"的每一侧都有两个空格,因此机器人认为"和"是一个关键字.整个表达式需要适合测试用例表的单个单元格.

解决方案是在"和"的每一侧只放一个空格:

Run Keyword If    ${YearDiff}>=0 and ${MonthDiff}>=0    Click Element    id=Left_Calendar_Icon
Run Code Online (Sandbox Code Playgroud)