1

I have a keyword which checks, if a button value is Completed, once it is found, I want that keyword to stop and return the status. However the the button value Completed is not fixed to any time interval. I want to call the keyword recursively to check for value of button at every 3 minutes.

*** Test Case ***
   Navigate to menu    Home  Status
   #Something here to call the keywrod `Check run status` for every 3 
   minutes until ${passd} is true or 30 minutes are passed. 


***Keywrod***
 Check run status
${btnValue}  Get Text   //button[@id="btn_status"]  
${passed} =   Run Keyword And Return Status   Should be Equal   ${btnValue}   
Completed   
[Return]   ${passed}

How to iterate this with time interval & How can we achieve this with robotframework?

1
  • 2
    Do you want to apply recursion indeed or just repeat some actions?
    – wec
    Commented Oct 7, 2019 at 11:13

2 Answers 2

3

You could use Wait until keyword succeeds The keyword will repeat executing until it succeeds you can specific the time to repeat the keyword like so

*** Test Case ***
Repeat Keyword Test
   Navigate to menu    Home  Status
   ${status} =  wait until keyword succeeds  30 minutes  3 minutes  Check run status


***Keywrod***
Check run status
  ${btnValue}  Get Text   //button[@id="btn_status"]  
  ${passed} =   Run Keyword And Return Status   Should be Equal   ${btnValue}  Completed      
  [Return]   ${passed}
0

I am not sure if you want to use Robot for status monitoring, but have you tried:

Loops: How to write a loop while in Robot Framework.

Or invert the result and use to repeat if failed: Wait Until Keyword Succeeds.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.