Showing posts with label Crypt. Show all posts
Showing posts with label Crypt. Show all posts

Friday, August 10, 2012

QTP Crypt Object


Crypt Object in QTP is used to Encrypt the given password, This scenario is just to confirm whether the given password is saving as Encrypted, This object is used in different ways in different methods,
Below scripts are done for a sample login page, to show how the given password is encrypted before the page get login

SystemUtil.Run "C:\Program Files\Internet Explorer\IEXPLORE.EXE",
"test.sso.com"
Browser("IdPInitiated:Identity").Page("IdPInitiated:Identity").WebEdit("txtUserName").
Set"68testuser1"
pwd="abc123"
e_pwd=Crypt.Encrypt(pwd)
msgbox e_pwd
Browser("IdPInitiated:Identity").Page("IdPInitiated:Identity").WebEdit("txtPassword").SetSecure e_pwd
Browser("IdPInitiated:Identity").Page("IdPInitiated:Identity").WebButton("Login").Click
Browser("IdPInitiated:Identity").Page("SPInitiated:Identity Provider").WebButton("Goto Sdp").Click

















Before the password is getting entered it gets encrypted and shows the encrypted text in the (msgbox) as we declared in the script, Once the 'OK' button is clicked from the msgbox, the password get entered in to the password field for the next step to the login.

There is another method the password get encrypted directly to the password field for login by declaring below variable in different object method

SystemUtil.Run "C:\Program Files\Internet Explorer\IEXPLORE.EXE",
"test.sso.com"
Browser("IdPInitiated:Identity").Page("IdPInitiated:Identity").WebEdit("txtUserName").
Set"68testuser1"
password = "abc123"
sEncryptedPwd = Crypt.Encrypt(password)
Browser("IdPInitiated:Identity").Page("IdPInitiated:Identity").WebEdit("txtPassword").Set"abc123"
Browser("IdPInitiated:Identity").Page("IdPInitiated:Identity").WebButton("Login").Click
Browser("IdPInitiated:Identity").Page("SPInitiated:Identity Provider").WebButton("Goto Sdp").Click