Read and Write Gmail Messages

Hi Hari,

I tried using your plugin and it is working fine for gmail.
I am unable to use the plugin for outlook mails. Below is the error I encountered.

Does the plugin is designed only for Gmail or for both Gmail and Outlook mails?
Please suggest any way to perform the same operations (readLatestEmailBodyContent, getEmailsCount, etc..) on outlook mail.

Thanks in advance.

I have the same issue as you. For those who have the same problem that you can’t read the content and have to forward it… take a look to this keyword I found:

(Where says “docusign?token” at the bottom you have to modified with word that are contained in the URL your want to open)

package keywordUtils

import javax.mail.Folder
import javax.mail.Message
import javax.mail.MessagingException
import javax.mail.NoSuchProviderException
import javax.mail.Session
import javax.mail.Store
import javax.mail.Message.RecipientType
import javax.mail.search.AndTerm
import javax.mail.search.RecipientStringTerm
import javax.mail.search.SearchTerm
import javax.mail.search.SubjectTerm

import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element

import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

import internal.GlobalVariable

public class ConfirmEmail {
	
	@Keyword
	def fetchEmailVerifyURL(String QAEmail, String QAPassword, String EmailRecipient) {

		String url = findConfirmEmailURL(QAEmail, QAPassword, EmailRecipient)
		WebUI.navigateToUrl(url)								// Navigate to the URL retrieved
	}

	// Mail related methods
	private String findConfirmEmailURL(String QAEmail, String QAPassword, String EmailRecipient) throws MessagingException {

		SearchTerm filter = createFilter(EmailRecipient);						// 1. Create mail search filter for our mailbox
		Store store = connect(QAEmail, QAPassword);								// 2. Connect to our mailbox
		String content = getMessageContent(store, filter);		// 3. Retrieve the message body from the received email
		String url = getURL(content);							// 4. Get the confirmation URL from the message body
		return url;
	}


	private SearchTerm createFilter(String Recipient){
		SearchTerm t1 = new RecipientStringTerm(RecipientType.TO, Recipient);
		SearchTerm t2 = new SubjectTerm("Welcome to LemonBrew");
		SearchTerm st = new AndTerm(t1, t2);
		return st;
	}

	private Store connect(String QAEmail, String QAPassword) throws MessagingException {

		Properties props = new Properties();
		props.setProperty("mail.store.protocol", "imaps");

		Session session = Session.getDefaultInstance(props, null);
		Store store;

		try{

			store = session.getStore("imaps");
			store.connect("imap.gmail.com", QAEmail, QAPassword);

		}catch (NoSuchProviderException e) {

			e.printStackTrace();
			throw e;
		}catch (MessagingException e) {

			e.printStackTrace();
			throw e;
		}

		return store;
	}

	public String getMessageContent(Store store, SearchTerm filter) throws MessagingException {

		String mailMessageContent = "";
		try{

			Folder emailFolder = store.getFolder("INBOX");
			emailFolder.open(Folder.READ_ONLY);

			Message[] messages = emailFolder.search(filter);
			System.out.println("messages.length---" + messages.length);

			if(messages.length != 0){

				Message message = messages[0];

				String subject = message.getSubject();
				String from = message.getFrom()[0].toString();
				String content = message.getContent().toString();

				mailMessageContent = content;
			}

			emailFolder.close(false);
		} catch (MessagingException e) {

			e.printStackTrace();
		} catch (Exception e) {

			e.printStackTrace();
		}finally {

			store.close();
		}

		return mailMessageContent;
	}

	private String getURL(String content){
		Document doc = Jsoup.parse(content);
		//Element element = doc.selectFirst(GlobalVariable.G_Confirm_Url_Search_Expr);
		Element element = doc.getElementsByAttributeValueContaining("href", "docusign?token")[0]
		return element.attr("href");
	}
}

You can find more info here →

1 Like

Hi everyone,

I found error like this

=============== ROOT CAUSE =====================

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@70e659aa]

For trouble shooting, please visit: https://docs.katalon.com/katalon-studio/docs/troubleshoot-common-execution-exceptions-web-test.html

================================================

11-11-2020 04:55:22 PM Test Cases/motordev/Demo/Test email

Elapsed time: 3.984s

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

Test Cases/motordev/Demo/Test email 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@70e659aa]

Possible solutions: wait(), any(), wait(long), each(groovy.lang.Closure), any(groovy.lang.Closure), and(java.lang.Boolean)

at com.testwithhari.katalon.plugins.Gmail.invokeMethod(Gmail.groovy)

at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)

at Test email.run(Test email:18)

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:339)

at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:330)

at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:309)

at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:301)

at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:235)

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 TempTestCase1605088518877.run(TempTestCase1605088518877.groovy:25)

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@70e659aa]

Possible solutions: wait(), any(), wait(long), each(groovy.lang.Closure), any(groovy.lang.Closure), and(java.lang.Boolean)

at com.testwithhari.katalon.plugins.Gmail.writePart(Gmail.groovy:262)

at com.testwithhari.katalon.plugins.Gmail.readLatestEMailBodyContent(Gmail.groovy:67)

… 14 more

anyone have the solution? read email from Gmail?

thanks,
Regards,

Hello Hari,

Major guys are getting issue related below image,

Can you please provide the best solution?

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@3c818ac4]

Hi there,

did you find a solution to this problem? Still looking for one.

Thanks in advance.

Hi, A forgot password link sent to gmail directly from a website is not working for me. If I forward the mail to the same account or another gmail account, the test will pass. When forwarding, the mail seems to get a different format, so the test succeeds.

Hi, I am working on automation testing for ios / android app.
I have used your plugin to get and read email and it works great for me.
But I have a question - there is a sign up flow where user complete registration on mobile app and have to click on verification link in the email. How can do it in my mobile app automation?

So, there is a code where I get message and find a link. How can I click it?

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testng.keyword.TestNGBuiltinKeywords as TestNGKW
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.Keys as Keys

String emailc = CustomKeywords.‘com.testwithhari.katalon.plugins.Gmail.readLatestEMailBodyContent’(test@gmail.com’,
‘sxzcptest’, ‘Inbox’)

printf(emailc)
def link = emailc.findAll(/http://\s+/)

Hi Hari,

I tired to read the latest email content by using your method - “com.testwithhari.katalon.plugins.Gmail.readLatestEMailBodyContent” but ended up getting below error message:

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@369c9bb]
Possible solutions: wait(), any(), wait(long), and(java.lang.Boolean), any(groovy.lang.Closure), each(groovy.lang.Closure)

Hi Hari,

I have used
String mail_content1 = CustomKeywords.‘com.testwithhari.katalon.plugins.Gmail.readLatestEMailBodyContent’(‘username’, ‘password’, ‘Inbox’)
println(mail_content1)

So I am able to get the body of the mail. How can I get the mail subject text ?
Also, Is there any way to delete particular mail ?
Please don the needful.

Thanks in Advance

Hi @Hari I was trying to use this plugin for katalon 8.3.5 version and facing the same issue of “Connection Timed Out”. I tweaked gmail setting too so what am I missing here?

If anyone having issue with new Gmail less secure app change, please follow this steps and create secure app password and change it with your existing password :-
0

Less secure apps no longer supported by google after 30 May 2022 . To solve Powershell gmail error message ‘5.7.0 Authentication Required’ , you need turn on App password for your google account using below steps.

  1. Login to your Gmail , http://gmail.google.com
  2. After login, go to https://myaccount.google.com/signinoptions/two-step-verification , to make sure you enable “two step verification” on your gamil account.
  3. Then Create your application password via https://security.google.com/settings/security/apppasswords
  4. Below screen will loaded , click “Select app” drop-down control and select “Other” , then give a value to it , eg PowershellApp , then click “GENERATE” button [![enter image description here]
  5. You will get a 16 digits App password , now note it down.
  6. Finally , go https://accounts.google.com/DisplayUnlockCaptcha enable “external access to your Google account”
3 Likes

Hello

When I am running a test case in test form(AWS) containing Gmail Plugin. I am getting Following error. Can anyone please help in resolving this

Login/Receive_Verification_code FAILED. Reason: org.codehaus.groovy.runtime.InvokerInvocationException: javax.mail.MessagingException: Connection timed out: connect; nested exception is: java.net.ConnectException: Connection timed out: connect at com.testwithhari.katalon.plugins.Gmail.invokeMethod(Gmail.groovy) at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)

Still getting the below error. Is there any other setting i need to change on Gmail to provide access. Would appreciate your help regarding this

2022-07-21 12:30:37.366 ERROR k.k.c.m.CustomKeywordDelegatingMetaClass - :x: javax.mail.MessagingException: Connection timed out: connect;
nested exception is:
java.net.ConnectException: Connection timed out: connect
2022-07-21 12:30:37.370 ERROR c.k.katalon.core.main.TestCaseExecutor - :x: Test Cases/readGmailContent FAILED.
Reason:
com.kms.katalon.core.exception.StepErrorException: org.codehaus.groovy.runtime.InvokerInvocationException: javax.mail.MessagingException: Connection timed out: connect;
nested exception is:
java.net.ConnectException: Connection timed out: connect

I’m facing an error with the connections.

What I’m trying to do

I’m trying to create some SMDEmailUtils that will:

  • get message count for an inbox
  • get new message for an inbox
  • return the name of the folder that has the new message, within some timeOut

How it is going

The first two methods are just fine..

However, in the latter, I am facing the following error:

Reason:
javax.mail.AuthenticationFailedException: [ALERT] Too many simultaneous connections. (Failure)
	at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:661)
	at com.testwithhari.katalon.plugins.Gmail.getEmailsCount(Gmail.groovy:209)
	at com.testwithhari.katalon.plugins.Gmail$getEmailsCount.call(Unknown Source)
	at com.signaturemd.utils.SMDEmailUtils.GetMessageCount(SMDEmailUtils.groovy:61)
	at com.signaturemd.utils.SMDEmailUtils$GetMessageCount$1.callStatic(Unknown Source)
	at com.signaturemd.utils.SMDEmailUtils$_GetNewMessageFolderName_closure1.doCall(SMDEmailUtils.groovy:46)
	at com.signaturemd.utils.SMDEmailUtils.GetNewMessageFolderName(SMDEmailUtils.groovy:45)
	at com.signaturemd.utils.SMDEmailUtils$GetNewMessageFolderName$0.callStatic(Unknown Source)
	at com.signaturemd.utils.SMDEmailUtils.ExtractSignUpLink(SMDEmailUtils.groovy:31)
	at com.signaturemd.utils.SMDEmailUtils$ExtractSignUpLink.call(Unknown Source)
	at Step 1.5.run(Step 1.5:4)
	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:448)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:142)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:133)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1661801070155.run(TempTestCase1661801070155.groovy:25)

OK, let’s see some code!

Ok, ok!!

public final class SMDEmailUtils {
	public static final String MainInboxFolder = "INBOX";
	public static final String SpamFolder = "[Gmail]/Spam";

	public static String GetMainEmail() {
		if (!GeneralWebUIUtils.GlobalVariableExists('emailID'))
			return "dev@example.com";
		return GlobalVariable.emailID.toString();
	}

	public static String ExtractSignUpLink() {
		final String folderName = this.GetNewMessageFolderName(30, FailureHandling.STOP_ON_FAILURE);
		return this.ProcessXML(this.GetNewMessage(folderName), "//a[.//div[@class = 'sign-mail-btn-text']]");
	}

	public static String GetNewMessageFolderName(int timeOut,
			FailureHandling failureHandling = FailureHandling.STOP_ON_FAILURE) {
		final long startTime = System.currentTimeMillis()

		final Map<String, Integer> folderMessageCountDict = [
			(this.MainInboxFolder) : this.GetMessageCount(this.MainInboxFolder),
			(this.SpamFolder) : this.GetMessageCount(this.SpamFolder),
		];

		while (System.currentTimeMillis() < startTime + 1000 * timeOut) {
			final String folderName = folderMessageCountDict.findResult({String folderName, int initialMessageCount ->
				if (initialMessageCount < this.GetMessageCount(folderName))
					return folderName;
				return null;
			})

			if ((folderName != null) && (!folderName.isEmpty()))
				return folderName;

			// TODO: we shouldn't have to do some hard-coded suspension of the runtime. We need to close the store somehow
			Thread.sleep(1000);
		}

		throw new StepFailedException("Failed to find a folder with a new message in it after ${(System.currentTimeMillis() - startTime) / 1000} seconds");
	}

	public static int GetMessageCount(String folderName) {
		return Gmail.getEmailsCount(this.GetMainEmail(), GlobalVariable.emailPassword, folderName);
	}

	public static String GetNewMessage(String folderName) {
		return Gmail.readLatestEMailBodyContent(this.GetMainEmail(), GlobalVariable.emailPassword, folderName);
	}

	/**
	 * **NOTE**: forked from https://stackoverflow.com/a/2269464/2027839 , and then refactored
	 * 
	 * Processes HTML or XML, using XPath
	 * 
	 * @param xml
	 * @param xpath
	 * @return the result 
	 */
	public static String ProcessXML(String xml, String xpath) {
		Element document = DocumentBuilderFactory.newInstance()
				.newDocumentBuilder()
				.parse(new ByteArrayInputStream( xml.bytes ))
				.documentElement;
		return XPathFactory.newInstance()
				.newXPath()
				.evaluate( xpath, document );
	}
}

In the test case, I am doing:

final String signupLink = SMDEmailUtils.ExtractSignUpLink();

What are you trying/thinking?

I’m looking under the hood of this simple plugin, see stores being initiated as temporary variables, but not close()d. For example:


/*     */ public class Gmail implements GroovyObject {
	/*     */ public static Properties properties;
	/*     */
	/*     */ public Gmail() {
		/*     */ CallSite[] var1 = $getCallSiteArray();
		/*     */ MetaClass var2 = this.$getStaticMetaClass();
		/*     */ this.metaClass = var2;
		/*     */ }
	/*     */
	/*     */ @Keyword
	/*     */ public static String readLatestEMailBodyContent(String emailID, String password, String folderLableName) {
		/*     */ CallSite[] var3 = $getCallSiteArray();
		/*  55 */ Object var4 = var3[0].callConstructor(Properties.class);
		properties = (Properties) ScriptBytecodeAdapter.castToType(var4, Properties.class);
		/*  56 */ var3[1].call(properties, "mail.store.protocol", "imaps");
		/*  57 */ Session emailSession = (Session) ScriptBytecodeAdapter
				.castToType(var3[2].call(Session.class, properties), Session.class);
		/*  58 */ Store store = (Store) ScriptBytecodeAdapter.castToType(var3[3].call(emailSession, "imaps"),
				Store.class);
		/*  59 */ var3[4].call(store, "imap.gmail.com", emailID, password);
		/*  60 */ Folder emailFolder = (Folder) ScriptBytecodeAdapter.castToType(var3[5].call(store, folderLableName),
				Folder.class);
		/*  61 */ var3[6].call(emailFolder, var3[7].callGetProperty(Folder.class));
		/*  62 */ Message[] messages = (Message[]) ScriptBytecodeAdapter.castToType(var3[8].call(emailFolder),
				Message[].class);
		/*     */
		/*  64 */ if (ScriptBytecodeAdapter.compareGreaterThan(var3[9].callGetProperty(messages), 0)) {
			/*     */
			/*  66 */ var3[10].call(KeywordUtil.class, "***********************************************************");
			/*  67 */ return (String) ShortTypeHandling.castToString(var3[11].callStatic(Gmail.class,
					var3[12].call(messages, var3[13].call(var3[14].callGetProperty(messages), 1))));
			/*     */
			/*     */
			/*     */
			/*     */ } else {
			/*  72 */ var3[15].call(KeywordUtil.class, "***********************************************************");
			/*  73 */ var3[16].call(KeywordUtil.class, "There are 0 mails in MailBox");
			/*  74 */ var3[17].call(KeywordUtil.class, "***********************************************************");
			/*     */
			/*  76 */ return "There are 0 mails in MailBox";
			/*     */ }
		/*     */ }
	 // ...other methods...
	/*     */ }

How can we close() the stores, or failing that, what can we do about this connection issue, given that the code is failing even though we suspend the polling of the inboxes for one second?

Hello, I have a Jenkins problem when using the plugin. I get a SocketTimeoutException when trying to reach the Gmail API from Jenkins. Locally, the test works.
I tried adding some addresses to the proxy whitelist. Unfortunately without success.

gmail.googleapis.com

does anyone have any ideas?

Hi Hari
Could you please check issue

Hi Hari
I am getting below error. Could you please check my issue .I am trying to read the gmail content .It worked earlier but now it is giving the below error .

Hi, I get the some error

2023-09-13 15:20:18.147 DEBUG testcase.Read Email                      - 3: mailbody = com.testwithhari.katalon.plugins.Gmail.readLatestEMailBodyContent(GmailUser, GmailAppPW, "Inbox")
2023-09-13 15:20:19.726 INFO  com.kms.katalon.core.util.KeywordUtil    - ***********************************************************
2023-09-13 15:20:19.734 INFO  com.kms.katalon.core.util.KeywordUtil    - This is the message envelope
2023-09-13 15:20:19.735 INFO  com.kms.katalon.core.util.KeywordUtil    - ---------------------------
2023-09-13 15:20:20.053 INFO  com.kms.katalon.core.util.KeywordUtil    - FROM: SSPv3 Support <dev-core-qa@exconim-technik.de>
----------------------------
2023-09-13 15:20:20.276 ERROR k.k.c.m.CustomKeywordDelegatingMetaClass - ❌ 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@173f73e7]
Possible solutions: wait(), any(), wait(long), any(groovy.lang.Closure), each(groovy.lang.Closure), and(java.lang.Boolean)
2023-09-13 15:20:20.280 ERROR c.k.katalon.core.main.TestCaseExecutor   - ❌ Test Cases/SSP/Read Email FAILED.
Reason:
com.kms.katalon.core.exception.StepErrorException: 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@173f73e7]
Possible solutions: wait(), any(), wait(long), any(groovy.lang.Closure), each(groovy.lang.Closure), and(java.lang.Boolean)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.throwError(CustomKeywordDelegatingMetaClass.java:101)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:73)
	at Read Email.run(Read Email:25)
	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:448)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:144)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:135)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1694611211500.run(TempTestCase1694611211500.groovy:25)
Caused by: 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@173f73e7]
Possible solutions: wait(), any(), wait(long), any(groovy.lang.Closure), each(groovy.lang.Closure), and(java.lang.Boolean)
	at com.testwithhari.katalon.plugins.Gmail.invokeMethod(Gmail.groovy)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:55)
	at Script1694097472011.run(Script1694097472011.groovy:25)
	... 11 more
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@173f73e7]
Possible solutions: wait(), any(), wait(long), any(groovy.lang.Closure), each(groovy.lang.Closure), and(java.lang.Boolean)
	at com.testwithhari.katalon.plugins.Gmail.writePart(Gmail.groovy:262)
	at com.testwithhari.katalon.plugins.Gmail.readLatestEMailBodyContent(Gmail.groovy:67)
	at com.testwithhari.katalon.plugins.Gmail.invokeMethod(Gmail.groovy)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:55)
	at Read Email.run(Read Email:25)
	... 11 more

2023-09-13 15:20:20.283 ERROR c.k.katalon.core.main.TestCaseExecutor   - ❌ Test Cases/SSP/Read Email 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@173f73e7]
Possible solutions: wait(), any(), wait(long), any(groovy.lang.Closure), each(groovy.lang.Closure), and(java.lang.Boolean)
	at com.testwithhari.katalon.plugins.Gmail.invokeMethod(Gmail.groovy)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:55)
	at Read Email.run(Read Email:25)
	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:448)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:144)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:135)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1694611211500.run(TempTestCase1694611211500.groovy:25)
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@173f73e7]
Possible solutions: wait(), any(), wait(long), any(groovy.lang.Closure), each(groovy.lang.Closure), and(java.lang.Boolean)
	at com.testwithhari.katalon.plugins.Gmail.writePart(Gmail.groovy:262)
	at com.testwithhari.katalon.plugins.Gmail.readLatestEMailBodyContent(Gmail.groovy:67)
	... 14 more

it only happens if the email content typ is “Content-Type: text/html;charset=UTF-8"” if I forword the email the to my self it change it to "Content-Type: text/plain; charset=“UTF-8"” and the i can read the mail cann you add this to your gmail plugin to read also text/html ??

Hey Hari, I’m getting below error while getting the email count, and same wile getting latest mail content. Is this plugin still working properly?

hey @akshay_sartabe
which katalon version do you use?

1 Like