Is there a method and/or best practice for protecting credentials in a Selenium project using Java?

The two main ones for my application will be user credentials for logging into the site, and DB credentials.


I usually will create a .properties file that contains username and password and then make sure my .gitignore file says to not include that file in code check-ins.

  • This is the way to go. That way you can share the property file that stores the credentials only to people who are authorized.
    – Julian
    Mar 14 '16 at 20:35

Late answer, but better late than never I suppose. A properties file works and can allow you to set authorization, true.

Better, would be to set up a secured repository for such credentials that can be called at runtime to retrieve them. Too many times, hard coded credentials in some file wind up getting pushed into version control or saved to a desktop, etc, and it winds up getting a company's data on pastebin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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