samedi 27 février 2021

Email verification with selenium

This is the method I'm using for get the verification code which received to the mail.I wanted to get only the verification code from this.so that ,I have used line preceding the code begins with. But I received the result as null

public String getVerificationCode() throws Exception {
Message email = getMessagesBySubject("ABCD | Email Verification", true, 5)[0];
BufferedReader reader = new BufferedReader(new InputStreamReader(email.getInputStream()));

String line;    
while ((line = reader.readLine()) != null) {
  if(line.startsWith("Please use below")) {
    return reader.readLine();
  }
}
return null;
}

Related email template I'm using,

Email Verification

We've noticed that you have updated your email address.

Please use below code to verify your email address.

2955

I would like to know why I received the return as null from this method and the ways to resolve this matter.

Aucun commentaire:

Enregistrer un commentaire