How to resolve this error "No keyword with name 'and' found"

Rakesh picture Rakesh · Nov 2, 2015 · Viewed 27k times · Source

When I execute this keyword, 'No keyword with name 'and' found error is displayed.

Test this keyword

[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

Correct me if i have used wrong syntax.

Answer

Bryan Oakley picture Bryan Oakley · Nov 2, 2015

You are using the space-separated format, which means that robot uses two or more spaces to separate keywords. You have two spaces on each side of "and" so robot thinks "and" is a keyword. The entire expression needs to fit in a single cell of the test case table.

The solution is to put only one space on each side of "and":

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