Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Validating Password field
#1
Not Solved
Hi, I am brand new to QTP and I would like to know how to validate the password field using QTP. The password field has the following constraints:

Password can contain 6 to 12 characters
Must be a combination of at least 3 of the below conditions
1. Lower Case
2. Upper Case
3. Numerics
4. Special Characters like (@#$%^&*-)

Example: Password123, P@12346, pass@123 etc. etc.

Would be great if you can help me out.

Thank You

Reply
#2
Not Solved
Hi,

You need to use regular expression for that.Try the below one.
Code:
Set RegEx = CreateObject("VBScript.RegExp")  'Create Object
RegEx.Pattern = "^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[[@#$^&*_-]).{6,12}" 'Set the pattern
strResult=RegEx.Test(strText) 'Test string,Replace strText with ur pwd
If strResult=False Then
msgbox "Invalid Password"
Else
msgbox "Valid Password"
End If
Set RegEx =Nothing

Regards,
Ankesh


Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Can we open a password protected zip file using QTP? arunarora1990 2 4,663 07-03-2011, 09:46 AM
Last Post: rajpes
  Regular Expression for a Password ritesh 3 4,220 11-16-2010, 03:54 PM
Last Post: ngocvo3103

Forum Jump:


Users browsing this thread: 1 Guest(s)