One of the LearnQTP readers asked this question:
Hi Ankur,
I need help with Input Box .
When I enter password in Inputox( Wpass = InputBox(”EnterPassword”)) its showing up the “password” instead of “********” ..we need to prompt input box for a password and we need to hide a password while it is being typed.Do you have solution for this ? I googled it I came up with VBScript..Is it possible with InputBox Function..
Now, as far as I know this can’t be handled either by using the built-in InputBox function or by using Crypt method.
For those who still wonder about the applicability of DotNetFactory, you can use it here.
Using Example-11 from one of our earlier posts on DotNetFactory, you can modify it and add UseSystemPasswordChar method to make sure the entered characters are masked. This is what the modified code would look like
Set MyForm = DotNetFactory.CreateInstance("System.Windows.Forms.Form", "System.Windows.Forms") Set MyText = DotNetFactory.CreateInstance("System.Windows.Forms.TextBox", "System.Windows.Forms") Set MyButton = DotNetFactory.CreateInstance("System.Windows.Forms.Button", "System.Windows.Forms") Set Pos = DotNetFactory.CreateInstance("System.Drawing.Point" ,"System.Drawing",x,y) Pos.X = 90 Pos.Y = 100 MyText.Location = Pos MyText.Width = 100 MyText.UseSystemPasswordChar = true Pos.X = 100 Pos.Y = 130 MyButton.Location = Pos MyButton.Text = "Close" MyForm.Controls.Add MyText MyForm.Controls.Add MyButton MyForm.CancelButton = MyButton MyForm.ShowDialog Msgbox MyText.Text Set MyText = Nothing Set MyButton = Nothing Set Pos = Nothing Set MyForm = Nothing
True property under MyText.UseSystemPasswordChar = true will make sure that the entered characters are masked and are not visible to the user.
Run the above piece of code and let me know if this worked for you.
This works great, but how would one and a text field to this for instruction to user?
Hi
i have one doubt in qtp.one of my friend asing me one doubt how to find out password masking or not…..by using msgbox
plz ….rply me its vey urgent
Hi Ankur,
I need a help for TE Window.
when i am using the below code to set password in password field , same thing it displayed in results window please help me on this.
TeWindow(“TeWindow”).Dialog(“User Authentication Dialog”). WinEdit(“Password:”).Set “Password”
Thanks,
Arjun.
we can user “ScriptPW” for Windows XP or Windows Server 2003..
Reference : http://blogs.technet.com/b/heyscriptingguy/archive/2005/02/04/how-can-i-mask-passwords-using-an-inputbox.aspx
hi ….
how to work with virtual object…can any1 explain with sample application
Hi Ankur,
I am looking for a concept “Broken Link” using descriptive programming” and how to test this for all the links .
Can you post the snippet for the following.
Thanxs in advance..
Don’t worry he will be fine. All our good wishes are with him.
It was not working . While, running script QTP can’t recognized Object.Input ask for Type for password and after putting letter in Input box, it’s want not encrypted.
Please let me know the solution and correct script.
In Vb script we use SetSecure to appear the password in ******* form.
Kindly check if there is any method for dot net available!