Ask a Question

Input a password with an inputbox

SOLVED
alexbreu
New Contributor

Input a password with an inputbox

Hello,

 

I would like to input a string with an inputbox. The problem is that :

if i iuse BuiltIn.inputBox(title,prompt,default), the input string is not hidden by special characters($,#,etc.). I want my password be hidden on the screen when i write the password.

 

i use VbScript.

 

i tried to use the activeX component CreateObject("ScriptPW.Password") but i have an error.

"ActiveX component can't create object: 'ScriptPW.Password'"

 

How can i solve my problem ? 

 

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
tristaanogre
Community Hero

Re: Input a password with an inputbox

BuiltIn.InputBox is intended to open a very simple dialog.  There are no fancy bells and whistles with this dialog like masking passwords or anything like that.

 

If you want to have a dialog come up that prompts for a password and masks the data entry on screen, you'll want to use the "UserForms" feature of TestComplete.  When you add a TcxTextEdit component to a user form, under the properties for that component, there is a property called "EchoMode".  By default, that's set to eemNormal. If you change that to eemPassword, it masks the data entry on screen as the user types.

 

See https://support.smartbear.com/testcomplete/docs/testing-with/advanced/user-forms/entering-passwords....

 

 


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

View solution in original post

8 REPLIES 8
baxatob
Community Hero

Re: Input a password with an inputbox

 

Hi!

 

Why do you need to input the password using some extra form? What are you going to do next?

 

 

 

tristaanogre
Community Hero

Re: Input a password with an inputbox

BuiltIn.InputBox is intended to open a very simple dialog.  There are no fancy bells and whistles with this dialog like masking passwords or anything like that.

 

If you want to have a dialog come up that prompts for a password and masks the data entry on screen, you'll want to use the "UserForms" feature of TestComplete.  When you add a TcxTextEdit component to a user form, under the properties for that component, there is a property called "EchoMode".  By default, that's set to eemNormal. If you change that to eemPassword, it masks the data entry on screen as the user types.

 

See https://support.smartbear.com/testcomplete/docs/testing-with/advanced/user-forms/entering-passwords....

 

 


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

View solution in original post

Marsha_R
Community Hero

Re: Input a password with an inputbox

I'm with @baxatob.  Why do you want to enter a password from another box?  You won't be able to run this test unattended if you do that.  If you're worried about security, you can use a password variable or something similar:

 

https://support.smartbear.com/testcomplete/docs/testing-with/advanced/passwords.html


Marsha_R
[Community Hero]
____
[Community Heroes] 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 Heroes]
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 Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
alexbreu
New Contributor

Re: Input a password with an inputbox

Thanks for your answers.

 

I would like use input box because the webapp i test need to login with LDAP.

 

I would like not to store my login and password into the script. So i choose (for the moment) to print an input box at the beginning of the test so as to get the login and password of the test user.

Yes, i could not launch the test with a launcher as Jenkins 🙂

 

I keep in mind your solution to store the password in a variable and i am going to test the tristaanogre solution. I will send you my results.

 

Thanks

tristaanogre
Community Hero

Re: Input a password with an inputbox

As mentioned, the solution that I suggested should be able to allow a user to input the password.  If, however, you store that in a variable to then enter in via Keys or SetText into some control, the possibility could be that the password would be exposed in plain text in the test log.  So, you will still want to store the password in a Project level variable of the Password data type.

 

And I do agree with @Marsha_R... I'm confident the user form will work for you... but now you have a test that must be run attended.  Someone has to be around in order to enter in the password to run the test.  If you're going to have the password in a Project level variable to begin with, it seems like a good work around would be to just set the password value there to begin with and bypass any user input.  This is what we do on our end for our application... we do have to log in with a secure password and we store that at the project level, no user input needed.


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
baxatob
Community Hero

Re: Input a password with an inputbox

+1 for .Variable of Password type.
If you want to exclude this info from the Log, you can create an Event handler to avoid this kind of event from the Log.
tristaanogre
Community Hero

Re: Input a password with an inputbox

If you use a password variable and you send that variable to either a "Keys" or a "SetText" call, the log will not reflect the password.  It will just simply say that the password was entered.  Really this is the best solution over all.


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
alexbreu
New Contributor

Re: Input a password with an inputbox

ok, As proposed by tristaanogre, i used a user form with a TcxTextEdit by modifying the EchoMode("eemPassword").

It works well.

 

For now, it's ok for me. No need to store the pwd in a variable but maybe later.

 

Thanks to everyone for your advices.

cancel
Showing results for 
Search instead for 
Did you mean: