How to solve "no signature of method" error in setText keyword for Looping function

1
This is the error message that i’ve got from the log viewer


This is my script, I am trying to set the text of the value obtained in Excel data

Is there anything missing in my script writing? Please Help.

It seems you are retrieving integers from dataDaftar.getValue('nama', Row) - try adding .toString() on the end:

dataDaftar.getValue('nama', Row).toString()

Alternatively…

(String) dataDaftar.getValue('nama', Row)

actually I’ve tried this looping function on a website and it runs smoothly.
The problem arises when I apply it to the mobile application :frowning:

Blockquote
07-22-2020 09:47:58 PM Test Cases/2. TC_DaftarNegative
Elapsed time: 4.754s
Test Cases/2. TC_DaftarNegative FAILED.
Reason:
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords.setText() is applicable for argument types: (com.kms.katalon.core.testobject.TestObject, java.lang.String) values: [TestObject - ‘Object Repository/Daftar/txt_Nama’, 123456789]
Possible solutions: setText(com.kms.katalon.core.testobject.TestObject, java.lang.String, int), getText(com.kms.katalon.core.testobject.TestObject, int), setText(com.kms.katalon.core.testobject.TestObject, java.lang.String, int, com.kms.katalon.core.model.FailureHandling), getText(com.kms.katalon.core.testobject.TestObject, int, com.kms.katalon.core.model.FailureHandling), clearText(com.kms.katalon.core.testobject.TestObject, int), sendKeys(com.kms.katalon.core.testobject.TestObject, java.lang.String)
at 2. TC_DaftarNegative.run(2. TC_DaftarNegative:30)
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:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestCaseMainPhase(TestSuiteExecutor.java:169)
at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:142)
at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:91)
at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:157)
at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
at TempTestSuite1595429259865.run(TempTestSuite1595429259865.groovy:36)

still getting the same error message

Blockquote
Mobile.verifyElementExist(findTestObject(‘Daftar/btn_Email’), 0)
Mobile.tap(findTestObject(‘Daftar/btn_Email’), 0)
Mobile.verifyElementExist(findTestObject(‘Daftar/ttl_Daftar’), 0)
def dataDaftar = findTestData(‘Data Files/NegativeD’)
for (def Row = 1; Row <= findTestData(‘Data Files/NegativeD’).getRowNumbers(); Row++) {
Mobile.waitForElementPresent(findTestObject(‘Daftar/txt_Nama’), 0)
Mobile.setText(findTestObject(‘Daftar/txt_Nama’), (String) dataDaftar.getValue(‘nama’, Row))
Mobile.setText(findTestObject(‘Daftar/txt_NomorHp’), dataDaftar.getValue(‘nomorHP’, Row))
Mobile.setText(findTestObject(‘Daftar/txt_Email’), dataDaftar.getValue(‘email’, Row))
Mobile.setText(findTestObject(‘Daftar/txt_BuatKataSandi’), dataDaftar.getValue(‘buatKataSandi’, Row))
Mobile.tap(findTestObject(‘Daftar/form_Daftar’), 0)
Mobile.tap(findTestObject(‘Daftar/btn_Daftar’), 0)
Mobile.verifyElementExist(findTestObject(‘Daftar/txt_FieldHarusDiisi’), 0)
Mobile.tap(findTestObject(‘Daftar/btn_OkError’), 0)
Mobile.verifyElementExist(findTestObject(‘Daftar/ttl_Daftar’), 0)
}

Herewith my full script.

@andhika9125

You need to add timeout parameter
Example:

Mobile.setText(findTestObject('Daftar/txt_Nama'), (String) dataDaftar.getValue('nama', Row), 0)

References: https://docs.katalon.com/katalon-studio/docs/mobile-set-text.html#description

1 Like

it’s solved now, thanks for your help :grinning: :innocent: