Forum Discussion
That's still an indication that something needs to be corrected in the automation. This is what we "lovingly" refer to here on the community as "timing" issues. It takes time, sometimes, for an object to appear. And the automation tries to run as fast as possible unless told to wait or detect or find. An even if you have those detections and waits in place, they may not be set to wait long enough. So, while it's an intermittent problem, it's still one that needs to be resolved. A rerun did not "fix" the problem, just you happened to run it in a situation where the application is not under as heavy a load, where the timing worked out better, etc. So, you rerun it today and it works... tomorrow it may fail again at the same point for the same reason. A failed test is a failed test. Fix the failure THEN re-run.
Yes, I totally agree with you, but if it still reports object cannot be found after I told it to wait for the page to load, I really don't know how to fix the issue then. I try not to hardcode a time out if it is not absolutely necessary to avoid unnecessary waiting.
- tristaanogre6 years agoEsteemed Contributor
Agreed, hardcoding is not the way to do it. But, obviously, something is going on with the timing. It might be that the "Wait" you have set is still not long enough. The "Wait" method for a page has a parameter that you can set to wait for longer than the default time in your TestComplete settings. It could be that you need to increase that amount to wait longer for the page to load. Again, keep in mind that's a MAXIMUM wait. It won't always wait that amount so, as an experiment, you could make it some astronomically huge number (120000 milliseconds which is 2 minutes) and that will at least see if it fixes the problem. Then you can, at your leisure, tweak it down.
- tristaanogre6 years agoEsteemed Contributor
And, honestly, if it takes longer than 2 minutes for a page to load, even if it's intermittant, I'd write that up as a bug. User experience is key with web apps. I know that if i'm going to a website, I get really ticked off if it takes FOREVER for something to happen if I'm not given some sort of message like "please wait" or "Processing..." or something.
- whuang6 years agoRegular Contributor
My codes call the same action 6 times during the test, and they were all using the same default wait for page time, which is 40 sec. Sometimes only the second call complains object cannot be found, sometimes it is the fourth call, sometimes it could be the second and the third call both not finding the object, but the page was loding no problem, I was monitoring the test while it was running, visually I could see the page was loaded in less than 2 seconds, and the TC progress bar at the top right which display "waiting for page to load" went away after 2 or 3 seconds, so I assumed TC detected the page was loaded completly. So in this case how can I force it to wait longer? I gave it 40 seconds, but it only took a couple seconds and then go to the next line of codes.