How to store the value of content-desc in string and print it ??

I have a use case in my mobile application. I am trying to store the value of content-desc of an object called grand_total, and print them in console -log ,. I have tried a lot of syntax, but keep hitting the wall

This is my code ( the one that I boxed in)… And katalon said that the object is null object.

This is the full error message :
=============== ROOT CAUSE =====================

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

09-12-2022 01:54:14 PM grand_total = getValue().toString()

Elapsed time: 0.130s

Test Cases/MobileTesCovidDatangKeRS FAILED.
Reason:
java.lang.NullPointerException: Cannot invoke method getValue() on null object
** at MobileTesCovidDatangKeRS.run(MobileTesCovidDatangKeRS:120)**
** 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 TempTestCase1662965539986.run(TempTestCase1662965539986.groovy:25)**

This is the object properties of the object that I want to extract the “content-desc” from

Nb: I already tried checklist all the “Detect object by” , and also tried to checklist only the “content-desc”, but I still cant store and print the value of content-desc.

Any help will be greatlty appreciated. Thanks

Maybe try using Mobile.getAttribute(grand_ttl, 'content-desc', 5).

1 Like

I already tried using your suggestion, but it also returned nothing… Any other suggestion ??