How to automate and verify password authentication using selenium and java: password should be accept minimum 6 char with at least one number and one special char are must require ?.

  • Please give us a little more context. What have you tried so far? what language are you looking to use? Do you have experience with developing code?
    – Swagin9
    Commented Apr 19, 2017 at 12:14
  • I can't tell whether you are asking whether a 6-character minimum is ok or telling us that the requirement is a 6-character minimum.
    – user246
    Commented Apr 19, 2017 at 12:16

3 Answers 3


Basically you will check if the application behaves correctly when valid and invalid passwords are tried.

  1. When using a valid password, the system goes to the landing screen/page;

  2. When using a invalid password, the system displays same error message (and maybe logs the event in a logging database);

You can check a description of scenarios that I wrote for validating a login page here.

You can either use a fixed set of valid and invalid passwords or generate the inputs using a modal-based testing tool like OSMO.


Random people on the Internet can't tell you what your password policy should be.

If you own defining the policy, you should know there there are different schools of thought on password restrictions; see for example https://security.stackexchange.com/questions/29836/what-are-good-requirements-for-a-password.

If you are a tester, you should ask for the policy the software is supposed to enforce.

  • It looks like they have the password policy in place, but his question seems to be more around how to create an automated test to meet that criteria.
    – Swagin9
    Commented Apr 19, 2017 at 12:16
  • Maybe. I can't tell from how the question is written.
    – user246
    Commented Apr 19, 2017 at 12:18
  • He is asking for how to automate test cases for password field Commented Apr 19, 2017 at 13:17

I would use a regex pattern match. I'm not a guru in this, but there seems to be a good answer in SO here.

To save the extra click, @Srinivas' closest answer is:-

Minimum 8 characters at least 1 Uppercase Alphabet, 1 Lowercase Alphabet, 1 Number and 1 Special Character:


It will take some playing with, but that should get you what you are after.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.