How to verify text contains with numbers and special characters

Hello!

How can i verify the text with contains of numbers and special characters? I used this syntax WebUI.verifyTextPresent(’$16.50’, true) and I got an error below.

JPetStore Demo 2021-10-16 at 12.25.03 PM

For trouble shooting, please visit: https://docs.katalon.com/katalon-studio/docs/troubleshooting.html

10-16-2021 12:23:50 PM verifyTextPresent("$16.50", true)

Elapsed time: 0.768s

Unable to verify text ‘$16.50’ is present using regular expression (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to verify text ‘$16.50’ is present using regular expression
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:74)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.verifyTextPresent(WebUiBuiltInKeywords.groovy:1723)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$verifyTextPresent$4.call(Unknown Source)
at TC-002.run(TC-002:66)
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:430)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:421)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:400)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:392)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:273)
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 TempTestCase1634358176770.run(TempTestCase1634358176770.groovy:25)
Caused by: com.kms.katalon.core.exception.StepFailedException: Text ‘$16.50’ is not present on page using regular expression
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
at com.kms.katalon.core.webui.keyword.builtin.VerifyTextPresentKeyword$_verifyTextPresent_closure1.doCall(VerifyTextPresentKeyword.groovy:79)
at com.kms.katalon.core.webui.keyword.builtin.VerifyTextPresentKeyword$_verifyTextPresent_closure1.call(VerifyTextPresentKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
… 17 more
)

A couple of issues with your statement. You have the boolean as true, which means you want to use Regular Expression. However, the dollar sign has a special meaning in RegEx but you don’t want that. So you should use false, and also use an escape on the dollar sign. Try:
WebUI.verifyTextPresent('\$16.50', false)

Saying that, it may be a better test if you verify the contents of the two cells that their respective value is correct. To do that, you can start with the Spy tool, but you could also right click and choose, Inspect, to review the HTML.