Read and Write Gmail Messages

That’s the same error I’m seeing, satish1607.

Hello Satish / Brian, Could you please check the version of katalon-gmail plugin version. If you got 1.1.0,. you should reload the plugin to update new version. The current plugin version is 1.2.0. Please check and confirm. Thanks

I have 1.2.0:

image

Hi Hari, I’m having the same problem described above by Satish and Brian. I’m using the 1.2.0 version.

I am using latest one 1.2, one more thing I observed that

OTP email (multi line with image) is not reading where as when I sent plain text in email format in that case same code is working and reading the email.

Please look if its able to read when mail contains the image text, url nombers etc.

Cheers
Satish Pal

hi,

i think it's better way to do own .jar for gmail sending / reading tasks
with this way you will get just functions to your needs
google is full of instructions and Jidea is free java editor

Hi, I have add a video in my youtube channel explaining how to work with the plug-in. Please have a look and let know if it could help you.

Thanks

Hi, I have add a video in my youtube channel explaining how to work with the plug-in. Please have a look and let know if it could help you.

Thanks

1 Like

Hi, I have added a video in my channel explaining how to work with Katalon gmail plugin. Please have a look. Thanks

Thanks for providing the video I am now clear with plugins, my problem is OTP mail is coming in multiline format along with link and image which you have shown in the video, so struggling to extract OTP from Multiline.

Thanks for the video again.
It helps a lot.

Thanks for the video. Can you increase the max KS version to 6.1.4 so that I can install the plugin again?

Hi Brian, I have updated the plugin version to 6.1.4. Please check.
Let me know if you need more help. Thanks

Thanks Hari. I finally got it to work! I was able to use your plugin to parse the latest email, get a URL from the email, and then open my browser to that URL. It’s perfect for my scenario where I need to click on a Verification link for a new user account. Here’s the code:

import java.util.regex.Matcher
import java.util.regex.Pattern
String emailc = CustomKeywords.'com.testwithhari.katalon.plugins.Gmail.readLatestEMailBodyContent'(GlobalVariable.email, 
    GlobalVariable.password, GlobalVariable.box)

Pattern urlPattern = Pattern.compile('\\b(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]', Pattern.CASE_INSENSITIVE)

String urlString = emailc

Matcher matcher = urlPattern.matcher(urlString)

while (matcher.find()) {
    String address = matcher.group()

    println('Got URL: ' + address)
	WebUI.openBrowser(address)
}

Hi Brian_Batt,

That is really great.
Finally good to see that plugin is working for your as you expected. Let me know if you need more help.

Please do let me know how do I parse text if I have multiline text and link in mail.

Hi Hari ,

I am still facing below issue.Please can you help

Elapsed time: 5.933s

com.testwithhari.katalon.plugins.Gmail.invokeMethod:0

Test Cases/New Test Case FAILED.
Reason:
org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: java.lang.Boolean.call() is applicable for argument types: (com.testwithhari.katalon.plugins.Gmail$_writePart_closure1) values: [com.testwithhari.katalon.plugins.Gmail$_writePart_closure1@2b62442c]
Possible solutions: wait(), any(), wait(long), and(java.lang.Boolean), each(groovy.lang.Closure), any(groovy.lang.Closure)
at com.testwithhari.katalon.plugins.Gmail.invokeMethod(Gmail.groovy)
at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
at New Test Case.run(New Test Case:16)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1558692664925.run(TempTestCase1558692664925.groovy:21)
Caused by: groovy.lang.MissingMethodException: No signature of method: java.lang.Boolean.call() is applicable for argument types: (com.testwithhari.katalon.plugins.Gmail$_writePart_closure1) values: [com.testwithhari.katalon.plugins.Gmail$_writePart_closure1@2b62442c]
Possible solutions: wait(), any(), wait(long), and(java.lang.Boolean), each(groovy.lang.Closure), any(groovy.lang.Closure)
at com.testwithhari.katalon.plugins.Gmail.writePart(Gmail.groovy:262)
at com.testwithhari.katalon.plugins.Gmail.readLatestEMailBodyContent(Gmail.groovy:67)

Hari ,

In my automation testing , i have to capture OTP received from admin`s email
I am getting above error while doing so but if i forward that OTP email to myself ( from me to me) and
then run the script, it works.

I am new in automation.Please let me know if i am missing something

Hi Vidya,

Thanks for using my plugin. regarding the error you getting, I feel the actual mail your received from admin, formate is the issue. Currently my plugin works for mail formate contains html, text and multi part.

Please refer the Video and make sure you are following all the steps right. Also, could you please confirm how your mail content looks.

Regards,

Hari

Thanks Hari for reply…yes i figured out the issue…as email is from ADMIN , it is not allowing me to read the content…

can you suggest me a way to forward that OTP email (which i receive from admin) to my personal Id as post that i can read OTP from email.

Thats good. I suggest that get sent OTP mail directly to your personal email. I think should be possible configuring your email at your application level. I hope this would help you.