Reputation: 427
So in my test i have keyword
that return list:
@{channels}= Get Channels
For example the return list is ['1', '4', '11']
And i want to loop over this list and verify that 1, 4 and 11 exist at that list.
This is what i have try:
FOR ${ELEMENT} IN @{channels}
Log ${ELEMENT}
List Should Contain Sub List @{channels} ${ELEMENT}
END
And i received this error
:
TypeError: Expected argument 1 to be a list or list-like, got string instead.
Upvotes: 1
Views: 8031
Reputation: 1242
the problem is in how you use the first variable. With the decorators you only tell robot framework how to work with the variables. You can read more about list variables and decorators here.
${channels}= Get Channels
just save the result as is($) using List Should Contain Value should match better since in your ${ELEMENT} there is no sublist.
FOR ${ELEMENT} IN @{channels}
Log ${ELEMENT}
List Should Contain Value ${channels} ${ELEMENT}
END
Upvotes: 2