Reputation: 971
When I run the code below I get an error message
Keyword 'BuiltIn.Log' expected 1 to 5 arguments, got 0.
for the second log to console
(within the if-clause). Why? Why doesn't it "see" the variable I try to send as an argument?
Googling doesn't return anything useful. I have tried several combinations of spaces and apostrophes but nothing has worked.
Function key above F12
[Arguments] ${fkey}
${ValidFKeys}= Create List F13 F14 F15 F16 F17
log to console ${fkey}
Run Keyword If $fkey in $ValidFKeys run keywords
... log to console ${fkey}
Upvotes: 0
Views: 270
Reputation: 20047
Check the Run Keywords documentation:
By default all arguments are expected to be keywords to be executed.
What happened is Run Keywords
treated Log To Console
as the first keyword to be ran, then the value of ${fkey}
as the second - it did not pass it as argument to the log. To overcome this, add an "AND" - so now it knows ${fkey}
is an argument; if yo udon't have any other keyword to be ran, either drop Run Keywords
, or use No Operation
:
Run Keyword If $fkey in $ValidFKeys run keywords
... log to console ${fkey} AND No Operation
Upvotes: 2