0

I have a problem in writing a loop in Robot Framework for a block of code.

This code firstly check some values (Minimum and Current), then compare them, and then increase another value (Quantity) by input text. I would like this block of code to be executed UNTIL the condition that Current is greater than Minimum is fulfilled.

How should I write such kind of condition? Thanks in advance.

${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 Answer 1

1

Ok, I manage to do this with simple FOR loop and EXIT FOR LOOP in ELSE condition.

: 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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.