Is there a way to save many values in one variable using a for-Loop in Robot framework?

Viewed 138

I need to collect every text witch is in a span element but the loop overwrite the items...

*** Variables ***
${items}    ${EMPTY}

*** Test Cases ***
...

FOR    ${i_i}    IN RANGE    ${Items_Count}
        ${i}=    Evaluate    ${i_i}+1
        ${items[i_i]}=    Get Text    //body[1]/table[1]/tbody[1]/tr/span[${i}]
END

...

it should look like this:

${items} = {txt1 | txt2 | txt3 | ... | textN}

but my result is:

${items} = {last text from span-element}
1 Answers

If you want to have a list of values:

@{list}   Create List
Append To List   ${list}   value_to_append

If you want a Dict-like of values:

&{dictionary}   Create Dictionary
Set To Dictionary   ${dictionary}   key   value
Related