Solved
Forum Discussion
HimanshuTayal
5 years agoCommunity Hero
If it is coming into response and you need to extract OTP then you can use below code to extract OTP from the String.
String str = "Your verification code is 126222.";
str = str.split(" ")[str.split(" ").length-1];
char[] charArray = str.toCharArray();
int charSize = charArray.length;
log.info ("String is : "+str);
StringBuilder sBuild = new StringBuilder();
for(int i=0;i<charSize;i++) {
if( Pattern.matches( "\\d", String.valueOf(charArray[i]) ) )
sBuild.append(charArray[i]);
}
log.info (sBuild.toString());_lauren11
5 years agoOccasional Contributor
HimanshuTayal Sir, that's great approach if i already have response from email in my script. But, I am sorry. I want to get this response from email directly. I do not have response already with me. I need to know, how to access it from email and password i store in variables
Thanks in advance