How to call a keyword recurvisely in Robot Framework



  • 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?



  • 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}
    

Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2