verifyTextPresent not working on CRM

Hello everyone,

I’ve been trying to make the method work on CRM, but it doesn’t seem to be able to locate the text. Basically what I’ve been trying to do is to see if the record I’ve created from the Portal side of my website is also created in CRM Dynamics. Then once it’s been found, click on that element.

Here, it shows that the name of the record is saved in my variable:

Here, it shows that my record is created in CRM:

The error i got is this:

02-25-2019 12:49:01 PM Test Cases/CRM PMT6

Elapsed time: 1m - 24,535s

com.kms.katalon.core.exception.StepFailedException: Unable to verify text 'LDT EXP 25/02/2019 12:49' is present  using regular expression (Root cause: com.kms.katalon.core.exception.StepFailedException: Text 'LDT EXP 25/02/2019 12:49' is not present on page  using regular expression)
	at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:36)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:65)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:27)
	at com.kms.katalon.core.webui.keyword.builtin.VerifyTextPresentKeyword.verifyTextPresent(VerifyTextPresentKeyword.groovy:83)
	at com.kms.katalon.core.webui.keyword.builtin.VerifyTextPresentKeyword.execute(VerifyTextPresentKeyword.groovy:68)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:53)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.verifyTextPresent(WebUiBuiltInKeywords.groovy:1693)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$verifyTextPresent$ Source)
	at CRM PMT6:42)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(
	at com.kms.katalon.core.main.TestCaseExecutor.execute(
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$ Source)

My code:

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 com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import 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.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 internal.GlobalVariable as GlobalVariable

WebUI.callTestCase(findTestCase('Potato Export WIP - Copy'), [:], FailureHandling.STOP_ON_FAILURE)



WebUI.setText(findTestObject('Object Repository/CRM PMT6/input_JavaScript requis_UserNa'), '')

WebUI.setEncryptedText(findTestObject('Object Repository/CRM PMT6/input_JavaScript requis_Passwo'), 'q7GPlJJ7WwlAGos1HEj2aT8r9TL5JOQZ')'Object Repository/CRM PMT6/span_Connexion'))'Object Repository/CRM PMT6/input_concat(Take a quick tour (1)'))'CRM PMT6/a_Microsoft Dynamics CRM_butto'))

WebUI.mouseOver(findTestObject('CRM PMT6/a_Microsoft Dynamics CRM'))

WebUI.delay(1)'CRM PMT6/a_Export'))

WebUI.mouseOver(findTestObject('CRM PMT6/span_Export'), FailureHandling.STOP_ON_FAILURE)

WebUI.delay(1);'CRM PMT6/a_Cases'))


WebUI.verifyTextPresent(GlobalVariable.case_ID, true)

So I call the first Test Case and save a string value onto my Global Variable called “case_ID” and then use that variable to check if the text exists on CRM.

Can anyone help me figure out a workaround?

GlobalVariables are unfortunately tricky (they shouldn’t be, but they are). So rather than opening that can of worms, how about you try something like the following.

Test Cases can return a value (your Test Case is actually a method running in a Groovy script class). And since you’re calling the TC like it’s a method, why not treat it as one?

So in the first TC, just…

return case_ID

Then, in your calling TC…

def case_ID = WebUI.callTestCase(findTestCase('Potato Export WIP - Copy'), ...)

Your method works as well, it stores the value into the variable. However, the verifyTextPresent method cannot find the stored value on CRM. I’ve tried the method on my portal side and it can find any String that I pass to it.

Any advice?


Some guesses…

Does it need to be a regex? Is the value a valid regex?

Is the text actually present when the test step is executing? (Did you try waiting?)

It doesn’t need to be a regex, actually it has to be a String. I made sure that the return value is a String. I’ve tried using the verifyTextPresent on the CRM page just to see if it could detect it when the Text was on the page, but it could not detect it.


There’s no issue with verifyTextPresent - pretty sure of that (we’d see a ton of complaints if there were). So there must be some reason why the text is evading the driver on the CRM site.

Dumb question: Is it actually present as text… i.e. “free text” in a span or similar? It’s not inside an input field of some description?

Using the WebSpy tool, it gives this:


Many records are created daily because other people are also testing different functionalities. The text can be clicked and leads to another page within CRM in order to do manipulation.

I also think that verifyTextPresent works fine since I tried using it on other web pages and it is capable of detecting the texts. It seems that it doesn’t work on CRM.

Any help would be appreciated.

So it’s in a frame… did you configure the test object to use a frame?

I don’t use Katalon like this, so I’m winging this from the dark side of the moon. :wink:

1 Like

You might on to something. Will do some research and get back with the results.

If this is an iframe issue maybe this post would help you:
It might be that you need to switch or use the iframe to access the TestObject.