Forum Discussion

alexbreu's avatar
alexbreu
New Contributor
7 years ago

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,

  • 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.html

     

     

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    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.html

     

     

  • baxatob's avatar
    baxatob
    Community Hero

     

    Hi!

     

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

     

     

     

  • alexbreu's avatar
    alexbreu
    New Contributor

    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's avatar
      tristaanogre
      Esteemed Contributor

      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.

      • baxatob's avatar
        baxatob
        Community Hero
        +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.
  • alexbreu's avatar
    alexbreu
    New Contributor

    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.