Forum Discussion
aqUtils.Delay (https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqutils/delay.html)
is what you're looking for, I believe.
However... it depends upon why you're waiting as to whether or not I'd suggest using it. As a rule of thumb, I don't like hardcoded "sleep" commands because, depending upon environment, server load, etc, execution times and wait times may vary.
If you can tell us WHY you need to introduce these sleeps, perhaps we can suggest a better way that will help with execution and robustness of your automation.
My application has 2 buttons:
1. Validate
2. Post
Step 1 : .Initially user clicks on Validate button, and it takes around 2-5 seconds for this operation to complete.
This is why I need to put some Implicit wait after clicking on Validate button , similar to selenium.
2. Later once this validation is completed, my Post button is enabled immediately.
Note : Page is not refreshed anywhere in this entire process, It is just like after first button is validated, second button gets enabled.
Please share the implicit wait commands, something like Thread.sleep(time) in Testcomplete script.
- LinoTadros6 years agoCommunity Hero
When you validate by clicking the first button, does the UI show at least a label somewhere that says "...validating" or anything at all on the UI so that it doe snot leave you hanging for 2 to 5 seconds?
If the answer is "No" then you have a bug report to file against R&D, as it is not acceptable nowadays to hang the system for 2 to 5 seconds without telling the user UI wise that you in the process of validating.
If there is a label somewhere on the UI stating that the validating is in progress then your the WaitProperty() command in JScript on the second button object to wait for the label text to no be available anymore to continue with the clicking of the second button
This way you don't have to sleep or delay for a number of seconds but wait for an indication from the label to disapear to move on with life.
Hope that helps
-Lino
- tristaanogre6 years agoEsteemed Contributor
In addition to what LinoTadros suggests, if the Post button isn't in existance or such, you can also use WaitChild or WaitAliasChild as methods to actually wait for the child object to Exist before proceeding. These "Wait" methods (documented https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/waiting-process-or-window-activation.html and https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/waiting-property-value.html and https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/waiting-state-changes.html) are the preferred ways to a hard sleep. Only if none of these works, would I put in a hard sleep.
Related Content
- 9 years ago
- 2 years ago
Recent Discussions
- 23 hours ago
- 2 days ago