Verify text present causes "NoSuchElementException"

Hi all :slight_smile:
I have test cases in which I need to verify text present on the page.
They all worked in the past, but now for some reason some of them are failed, and I get this error:

com.kms.katalon.core.exception.StepFailedException: Unable to verify text ‘הרשימות שלי’ is present
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
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:60)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.verifyTextPresent(WebUiBuiltInKeywords.groovy:1693)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$verifyTextPresent$ Source)
at All clicks on clicks on navbar:25)
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)
Caused by: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {“method”:“css selector”,“selector”:“body”}
(Session info: chrome=81.0.4044.138)
For documentation on this error, please visit: Exceptions | Selenium

This is the test case - the next “verify text present” is working fine:‘All click on navbar/Page_/obj_my zone navbar prod’))

WebUI.verifyTextPresent(‘הרשימות שלי’, false)‘All click on navbar/Page_/obj_learn english navbar dropdown’))‘All click on navbar/Page_/obj_vocab game navbar prod’))‘All click on navbar/Page_/obj_level choose foundation prod’))

WebUI.verifyTextPresent(‘אוצר מילים’, false)

It worked in the past, I think it started giving this error when my chrome was updated to version 81 (I downloaded the required chromedriver). As mentioned, it doesn’t happen in all the “verify text present” cases, and it happens in ones that were working in the past.


Just to test your theory that it’s Chrome at fault… what happens when you run it against Firefox?

Have you tried adding wait before verify text present. It could be that the page is not loaded completely.

A post was split to a new topic: JavaScript error: this.each is not a function

Thanks! I added it and it’s working now :slight_smile:

A post was merged into an existing topic: JavaScript error: this.each is not a function

I tried Firefox now and it worked there…
I tried adding “wait for page load” as @vtanguturi suggested and it helped


Good that the wait worked. You can also use explicit waits before you proceed with other actions. Can you select my post as the solution for you issue it might help others too.

This exception is thrown by various accessor methods to indicate that the element being requested does not exist . The next() method in Java returns the next element in the iteration or NoSuchElementException if the iteration has no more elements. The solution to this​ exception is to check whether the next position of an iterable is filled or empty. You should only move to this position if the check returns that the position is not empty. The following methods are used to check the next position:

  • hasNext()
  • hasMoreElements()