0

I have a problem and I do not know how to solve it. I have a class:

public class PasswordValidator {

private Pattern pattern;
private Matcher matcher;

  private static final String PASSWORD_PATTERN =
        "((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})";

  public PasswordValidator(){
      pattern = Pattern.compile(PASSWORD_PATTERN);
  }


  public boolean validate(final String password){

      matcher = pattern.matcher(password);
      return matcher.matches();

  }
}

I would like to add a result from a PasswordValidator.java class to an element that I call in the ReadData.java class,

Public class ReadData extends PasswordValidator {
Private static final String DIRECTORY_NAME = "C: \\ Users \\ Damian6666 \\ workspace846 \\ ChangePasswordAutomat1 \\ File.xlsx";


Public ReadData () throws Exception {
super();
}

Public void tc () throws IOException, InterruptedException, InvalidFormatException {

WebDriver driver = new FirefoxDriver ();
Driver.get ("https://profil.wp.pl/login.html?url=https%3A%2F%2Fpoczta.wp.pl%2Findexgwt.html%3Fflg%3D1&services=new_window_wp");
driver.findelement(By.id("password"))

Does anyone have any idea how to do this?

danio900409
  • 265
  • 2
  • 6
  • 22
  • It is unclear what it is you are trying to accomplish. Please add a detailed description with examples of what you are trying to do, what you have tried, and what the result was. – JeffC May 02 '17 at 22:01
  • I am trying to achieve random password generation. At first I tried this way: String upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; String smaller = "abcdefghijklmnopqrstuvwxyz"; String number = "0123456789"; String Characters = "~`! @ # $% ^ & * () -_ = + [{]} \\ |: \ '\ ", <.> /?"; String pwd = RandomStringUtils.random (9, upper + smaller + number + characters); But after the call I do not always get data from all 4 groups. – danio900409 May 02 '17 at 22:09
  • You need to put that info in the question itself so that others will see it also. Your question is still confusing... the question statement refers to a regex password validator but your comment is talking about password generation. Please go through the entire question and clean it up so that what you are asking is clear and consistent. – JeffC May 02 '17 at 22:46

0 Answers0