This is a migrated thread and some comments may be shown as answers.

exit loop?

2 Answers 143 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 2
Alan asked on 13 Mar 2012, 06:43 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Cody
Telerik team
answered on 13 Mar 2012, 10:28 PM
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
0
Alan
Top achievements
Rank 2
answered on 14 Mar 2012, 01:30 PM
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
Tags
General Discussions
Asked by
Alan
Top achievements
Rank 2
Answers by
Cody
Telerik team
Alan
Top achievements
Rank 2
Share this question
or