Is there any way we can use nested for loop in robot framework
FOR ${config_element} IN @{CONFIG CARD OBJECTS}
Go To Config Group ${config_element}
${left_nav_obj} Get Left Nav Objects
FOR ${left_nav} IN @{left_nav_obj}
Add to dashboard ${left_nav}
END
END
I am not finding any other way to to execute this test case without inner for loop
I’ve not had any issue with nested for loops in robot framework, so yes you can.
FYI - use 3 back ticks (`) before and after to denote a code block so your formatting doesn’t get messed up.
Remember robot framework, like python indents need to remain consistent.
So your code should look something like this:
FOR ${config_element} IN @{CONFIG CARD OBJECTS}
Go To Config Group ${config_element}
${left_nav_obj} Get Left Nav Objects
FOR ${left_nav} IN @{left_nav_obj}
Add to dashboard ${left_nav}
END
END
You also might need to try making some adjustments:
${left_nav_obj} might need to be specifies as a list being returned from Get Left Nav Objects to ensure it actually is a list so that the inner for look can iterate it
${left_nav_obj} might need an = to explicitly declare it’s a variable assignment
you may also want to log the result of ${left_nav_obj} to ensure you are getting what you expected in that variable
I would suggest trying it like this:
FOR ${config_element} IN @{CONFIG CARD OBJECTS}
Go To Config Group ${config_element}
@{left_nav_obj} = Get Left Nav Objects
Log ${left_nav_obj}
FOR ${left_nav} IN @{left_nav_obj}
Add to dashboard ${left_nav}
END
END