I am trying to get a list from the following python method through robot framework:
folders.py:
MAINFOLDERS = []
def get_locators():
return MAINFOLDERS
and the keyword:
Assert main folders are in the same order
${MAINFOLDERS}= folders.get_locators
As far as I understand, ${MAINFOLDERS}
should be a list that looks like this:
[
'//span[contains(text(), "AutomationTestFolder - 02 18 2022 12:54:02")]',
'//span[contains(text(), "AutomationTestFolder - 02 18 2022 12:54:05")]'
]
The problem is that the output is given as string
, not a list
. So the actual output is "['//span[contains(text(), "AutomationTestFolder - 02 18 2022 12:54:02")]','//span[contains(text(),"AutomationTestFolder - 02 18 2022 12:54:05")]']"
How can I create a list out of the output of folder.get_locators()
Answer: @{MAINFOLDERS}
instead of ${MAINFOLDERS}
Assert main folders are in the same order
@{MAINFOLDERS}= folders.get_locators
FOR ${F} IN @{MAINFOLDERS}
log to console F:${F}
END