How to Script Username and Password Using QTP
I really need to know how to Automate the Username and Password for 3 different web-based Surveys using QTP. Each Survey opens up a little differently but at the exact same point they all ask for the same username and password, so I need to know what's the best way to create a script so that the username and password is automated across the board for all 3 surverys since the username and password is the same for each.
Thanks so much
Re: How to Script Username and Password Using QTP
1. Browser(B).Page(P).WebEdit(Password).SetSecure "<Encrypted Password>"
password can be encrypted using datatable.
2. In case there are multiple application's authnticated using same User Id & Password then u can parameterize the same script & fetch UserID & Password from a text file..
Regards,
Nawab
Re: How to Script Username and Password Using QTP
OK Thanks so do I create a Script and then record the Username and Password and make that a Reuseable Action? How can I parameterize this and call it from Scripts that are already created? Is there a way to make this a reuseable action and call it in Scripts that are run in a batch without having to modify every script I already created?
Re: How to Script Username and Password Using QTP
If there are scripts present's for the different flows ..u just need to have a common data source for the userID & Password..
[COLOR="Orange"][B]Solution ONE[/B][/COLOR]
[COLOR="Magenta"]Master Action Call all the 3 actions with parameter's(User ID & Password)
Reusable Action1........put the data in Input Parameter's
Reusable Action2........put the data in Input Parameter's
Reusable Action3........put the data in Input Parameter's[/COLOR]
I am bit skeptical about ur implementation...could u please give details on how are u managing ur test..that can help us to give u a lucid answer.
Regards,
Nawab
Re: How to Script Username and Password Using QTP
OK so I can about 25 existing scripts and we commented out the Username and password portion because at first QTP was recongzing it, but now I need to record the Username and Password and make it a Reuseable action for all the existing scripts. Each script is going to use the exact same userid and password so I simply need to know #1 How to create that action in QTP 9.5 and then how to recall that action for all the existing scripts that will use that exact same user id and password. How do you tell 25 existing scripts to call One action if they are run in a batch?
Re: How to Script Username and Password Using QTP
How do I create parameters for the User ID & Password? I am very new to QTP so I appreciate all your help in this matter.
Re: How to Script Username and Password Using QTP
[QUOTE=sbbceo;32918]OK so I can about 25 existing scripts and we commented out the Username and password portion because at first QTP was recongzing it, but now I need to record the Username and Password and make it a Reuseable action for all the existing scripts. Each script is going to use the exact same userid and password so I simply need to know #1 How to create that action in QTP 9.5 and then how to recall that action for all the existing scripts that will use that exact same user id and password. How do you tell 25 existing scripts to call One action if they are run in a batch?[/QUOTE]
You just need the data (User ID & Password), please add the following function & add it in the resources.
-------------------------------------------------------------------------
Function f_CredT
Browser(b).Page(p).Frame(f).WebEdit(UserID).Set "UID"
Browser(b).Page(p).Frame(f).WebEdit(Password).SetSecure "Encrypted Password"
End Function
-------------------------------------------------------------------------
I hope this will help,
regards,
Nawab
Re: How to Script Username and Password Using QTP
How exactly do I add it to the resources and where exactly is that? in the (Userid) (Password) parts do I put the actual userid and password here and then where do I insert this entire function in my scripts?
I'm very new to QTP so forgive me.
Look forward to hearing from you soon.
Raymond
Re: How to Script Username and Password Using QTP
Also do I have to insert this function for every script or is there a way for every script to Automatically call this action without me having to insert it in each one? Let me know exact where to insert this function as well
Re: How to Script Username and Password Using QTP
You need to call this function in all of ur script.
Make sure that across the scripts u have consistency in OR Naming Conventions.....simply call the function as the .vbs resides in resources of all your scripts where ever its needed.
I am not suggesting an Reusable Action as it eats up a lot memory space.
good luck,
Nawab