Forum Discussion
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());
- _lauren115 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
- HimanshuTayal5 years agoCommunity Hero
_lauren11 : You mean you need to access browser and open particular Email and then access this OTP?
If this is the question then you need to integrate Selenium with soapui.
Let me know in case you need help on selenium.
- _lauren115 years agoOccasional Contributor
HimanshuTayal sir, Yes, exactly for this purpose, I will have to access browser and open particular Email and then access this OTP
I have only used soapUI for automation. Kindly, please enlighten me on how to integrate with selenium and access OTP. I am a novice in this.
Thanks in advance
Related Content
- 10 years ago
- 4 years ago
Recent Discussions
- 15 hours ago