exit loop?

3 posts, 1 answers
  1. Alan
    Alan avatar
    6 posts
    Member since:
    Aug 2011

    Posted 13 Mar 2012 Link to this post

    Hello,

    Is there a way to force an exit out of a loop using the UI or should this be handled in code?

    Here is my scenario: I am searching for a customer immediately after creating it.  Rather than specifying an execution delay, I'd rather have Telerik repeat this search until it is found, however if unsuccessful after 10 tries, then give up.  I could use the 'Loop' and specify 10 times, but if the customer is found on the second attempt, I don't want to execute the loop 8 more times.  I could use the 'While...Loop', but if the customer is never found, the search will continue infinitely.

    Any thoughts?  Thanks!
  2. Answer
    Cody
    Admin
    Cody avatar
    3354 posts

    Posted 13 Mar 2012 Link to this post

    Hello Alan,

    Instead of using a loop, can you use a Wait For Element Exists? Or is there some UI interaction (e.g. clicking a Refresh button) that must be performed before verifying this customer exists? If a UI interaction is required, a coded step is the only way to periodically check for it, wait for a while and refresh the display but not get stuck in an infinite loop.

    Greetings,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Alan
    Alan avatar
    6 posts
    Member since:
    Aug 2011

    Posted 14 Mar 2012 Link to this post

    Hi Cody,

    Unfortunately, the search needs to be refreshed, so a WaitFor condition will lead me to the infinite loop, which will not suffice.  I will poke around with a coded step.  Thanks for your help!

    Alan
Back to Top