An idea to verify the correct format (eg: email format, phone number format) is simple. We need the “Regular Expression Pattern” of each format and using Selenium IDE to compare, the result will be Passed if your value match with Regular Expression Pattern, and Failed if your value does not match with that format pattern.
There are some common Regular Expression Pattern, but you can customize to meet the business if needed.
Email Regular Expression Pattern.
1 |
regexp:^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$ |
Generic email address.
1 |
regexpi:^[A-Z0-9+_.-]+@[A-Z0-9.-]+$ |
Match a date in ‘mm/dd/yyyy’ format with any of the ‘-’, ‘/’, ‘.’ as separators.
1 |
regexp:(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d |
Date Format (dd/mm/yyyy).
1 |
regexp:(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/((19|20)\\d\\d) |
Password Regular Expression Pattern.
1 |
regexp:((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20}) |
Username Regular Expression Pattern.
1 |
regexp:^[a-z0-9_-]{3,15}$ |
URL Regular Expression Pattern.
1 |
regexp:^(https?|ftp|file)://.+$ |
————–
Example: Verify email and compare with Email Regular Expression Pattern by using Selenium IDE.
Command____Target____Value
verifyText ____ css=h1 ____(Regular Expression Pattern)
Recent Comments