有没有一种方法可以在 Robot 框架中使用 for-Loop 将多个值保存在一个变量中?
Is there a way to save many values in one variable using a for-Loop in Robot framework?
我需要收集每个文本 在 span 元素中
但是循环会覆盖项目...
*** 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
...
它应该是这样的:
${items} = {txt1 | txt2 | txt3 | ... | textN}
但我的结果是:
${items} = {last text from span-element}
如果您想要一个值列表:
@{list} Create List
Append To List ${list} value_to_append
如果你想要一个类似字典的值:
&{dictionary} Create Dictionary
Set To Dictionary ${dictionary} key value
我需要收集每个文本 在 span 元素中 但是循环会覆盖项目...
*** 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
...
它应该是这样的:
${items} = {txt1 | txt2 | txt3 | ... | textN}
但我的结果是:
${items} = {last text from span-element}
如果您想要一个值列表:
@{list} Create List
Append To List ${list} value_to_append
如果你想要一个类似字典的值:
&{dictionary} Create Dictionary
Set To Dictionary ${dictionary} key value