InputBox: How to tell if Cancel selected
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
InputBox: How to tell if Cancel selected
I am invoking the BuildIn InputBox to get user input from my TestComplete 12.5 Vbscript.
The InputBox dialog has 2 buttons: OK and Cancel and I would like a way for the user to abort the script execution. I thought the Cancel button might work, but the dialog behavior seems to be the same no matter which button is clicked. the typed value or default value gets returned. I cannot find documentation indicating how to determine which button was clicked.
Does anyone know how to tell if the user clicks Cancel?
Thanks
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Usually the point of an automated test is to remove the actual user interaction. What is it you're trying to accomplish by adding this dialog into the test?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Check BuiltIn.InputQuery() instead.
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
From the help (https://support.smartbear.com/testcomplete/docs/reference/program-objects/builtin/inputbox.html)
"
Result Value
If the user presses OK, InputBox
will return the entered string. Otherwise, it returns Default."
So, clicking cancel returns whatever you have indicated in the "Default" value... it doesn't cancel a script or test or anything... just returns a value.
If you're not using JavaScript, JScript, Python, or C++, then yes, InputQuery will work... but any of those languages won't work with InputQuery because of the "out" parameters.
So, if you want to use "InputBox", then set your default value to be whatever would be the "stop the test" value you desire. That way, if the user clicks "Cancel", then that default value will be returned as the result and the test will halt as you code it.... but note that if the user does not change the default value and clicks "OK", then it will still halt the test.
If you truly want to be able to create a dialog that will allow the user to control the test run, then I suggest you look into UserForms (https://support.smartbear.com/testcomplete/docs/testing-with/advanced/user-forms/about.html).
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
> I am invoking the BuildIn InputBox to get user input from my TestComplete 12.5 Vbscript.
Thus InputQuery() was suggested as a quick effortless replacement.
Though the reply by @tristaanogre is definitely more detailed and descriptive.
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
