Forum Discussion
9 Replies
- baxatobCommunity Hero
1. You can use breakpoints: https://support.smartbear.com/testcomplete/docs/testing-with/debugging/breakpoints/using.html
2. You can use a while loop. And if you really need to prompt something to the user, you can combine this loop with TestComplete indicator - https://support.smartbear.com/testcomplete/docs/testing-with/running/indicator.html
- RobertDAltmanOccasional Contributor
Since the answer included two options (breakpoint or while loop), I just want to point out that my "accepted" solution is the "while loop" plus a message displayed in the TestComplete Indicator. That solution simply pauses the automated interaction with the web page until the user does something detectable by the while loop. In my actual test case, I need to click a button protected by a CAPTCHA, which causes my website to redirect to a different page. In the case of the example I posted (to illustrate a bug I ran across), clicking on the button causes the button to be hidden. In either case, I can poll in the while loop waiting for the condition to exist (with timeout logic, etc.).
On a related subject: Suppose I want to pause to allow a user to enter a password in a form. Assuming that the only action I want the user to manually perform is to enter the password, what can I test for to terminate the while loop?
- karkadilValued Contributor
As an example - the length of the text in the text field, but you should know it, of course
- karkadilValued Contributor
You can use the Builtin.ShowMessage method
- RobertDAltmanOccasional Contributor
Builtin.ShowMessage doesn't seem to do what I want. Here's my script:
function Test1() { // Launch a website in Chrome Browsers.Item(btChrome).Run("http://www.indigo.health/"); // Enter some data into the fields of a "contact us" form Aliases.browser.pageWwwIndigoHealth.formForm.textboxEmail.SetText("rdaltman@gmail.com"); Aliases.browser.pageWwwIndigoHealth.formForm.textboxEmail.Keys("[Tab]"); Aliases.browser.pageWwwIndigoHealth.formForm.panel.panel.panel.textareaComment.Keys("Hi Bob. This is a test"); // The submit button has a hidden ReCaptcha on it; // Tell the user to manually click the button so that the CAPTCHA magic is happy BuiltIn.ShowMessage("Click the button!"); // Continue the script... Click on a button to go to another page Aliases.browser.pageWwwIndigoHealth.panel.panel.textnode.Click(120, 23); Aliases.browser.pageWwwIndigoHealthPatientInfoHt.Wait(); }
Up to the point where I call ShowMessage, things proceed as expected. It displays my web page and populates the text boxes. But when ShowMessage executes, the web page under test loads some oddball website while the TestComplete IDE is displayed with the message box in front of it. I can't click the button because it's no longer on the displayed web page.
- karkadilValued Contributor
This sounds very strange, the ShowMessage method should't interfere with browser.
Could you please show us screenshot of the both TestComplete and Crome at the moment when message displays?
Also, you can try using User Forms, but make sure you show the user form in modal view.