Reputation: 79
I an executing a simple FOR loop in robot framework. but I am getting the variable not found error.
I am executing below code.
*** Test Cases ***
ForLoop1
FOR ${i} IN RANGE 1 10
Log to console ${i}
END
I am getting below error in terminal
(venv) C:\Users\hp\PycharmProjects\RF_Automation\TestCases> robot FOrLoop.robot
c:\users\hp\python38-32\lib\runpy.py:126: RuntimeWarning: 'robot.run' found in sys.modules after import of package 'robot', but prior to execution of 'robot.run'
; this may result in unpredictable behaviour
warn(RuntimeWarning(msg))
==============================================================================
FOrLoop
==============================================================================
ForLoop1 | FAIL |
Variable '${i}' not found.
------------------------------------------------------------------------------
FOrLoop | FAIL |
1 critical test, 0 passed, 1 failed
Upvotes: 1
Views: 2297
Reputation: 25
Try this syntax instead
: FOR ${client} IN @{clients}
\ Log ${client}
Upvotes: 0
Reputation: 11
I've been struggling with the same error and I found that the keyword "FOR" was written "For" so not recognized as a keyword and thus the "Log to console" statement was trying to print an unknown variable value.
Upvotes: 1