我在Robot Framework中为一段代码编写循环时遇到了问题。
此代码首先检查一些值(最小值和当前值),然后比较它们,然后按输入文本增加另一个值(Quantity)。我希望在满足Current大于Minimum的条件下执行此代码块。
我该怎么写这种情况? 提前谢谢。
${Minimum}= Get Table Cell xpath=... 5 3
${Current}= Get Table Cell xpath=... 5 4
${status} ${value}= Run Keyword And Ignore Error
... Should be true ${Current} > ${Minimum}
${quantity}= Get Value xpath=
... Run Keyword If '${status}' == 'FAIL'
... Input Text xpath=${quantity+10}
答案 0 :(得分:1)
好的,我设法在ELSE条件下使用简单的FOR循环和EXIT FOR LOOP来完成此操作。
: FOR ${i} IN RANGE 1 999
${BoxesMinimum}= Get Table Cell xpath=//someid 5 3
${BoxesCurrent}= Get Table Cell xpath=//someid 5 4
${status} ${value}= Run Keyword and Ignore Error
... Should be true ${BoxesCurrent} > ${BoxesMinimum}
${quantity}= Get Value xpath=//someid
Run Keyword If '${status}' == 'FAIL'
... Input Text xpath=//someid ${quantity+10}
... ELSE Exit for loop