I am using SoapUI open source. Through automation, I want to access the email by doing login(lets say, i have stored email id and password in two different variables), and get the verification code using groovy script in SoapUI open source
The email i shall be receiving will be from "no-reply@verification.com" and the content of the message will be in the format:--
"Your verification code is 126222."
Thanks in advance
Solved! Go to Solution.
Yes it will work surely i have also did this on my end to get OTP from gmail.
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
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());
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
@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
@_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.
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
@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
Add below jars into your soapui/bin/ext folder
1. selenium-server-standalone-3.141.59
2. selenium-java-3.6.0
3. guava-23.0
And then download latest driver of the browser you want to use
And then you can refer below url on how to use selenium first-webdriver-script
Let me know in case you need additional information
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
Thank you so much sir. Also, i did like to know, can it work with soap ui open source?
Yes it will work surely i have also did this on my end to get OTP from gmail.
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
Subject | Author | Latest Post |
---|---|---|