2017-08-25 66 views
0

我在编写代码块的Robot Framework中有一个循环问题。运行一个代码块直到循环机器人框架

此代码首先检查一些值(最小值和当前值),然后比较它们,然后通过输入文本增加另一个值(数量)。我希望这段代码能够被执行,直到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} 

回答

1

好的,我设法用简单的FOR循环和EXIT FOR LOOP在ELSE条件下做到这一点。

: 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