sameerjade
7 years agoFrequent Contributor
Solved
While loop in TestComplete
Hello All,
I am trying to use a while loop within a function in a TestComplete test item. When I run my test, it seems to be ignoring my while loop not executing it. Following is the code snippet:
while (i < 3) {
MyObjectName.Click();
i++;
}
If I have just the following, it works perfectly fine. Am I am missing something?
MyObjectName.Click();
Thank you,
Sameer
How are you initializing the variable i? At that point in the while loop, it is checking that value first... if i is > or = to three, you'll never enter the loop.
What I would do is the following:
var i = 0; while (i < 3) { MyObjectName.Click(); i++; }