Cannot Set Text on field

On mobile there is a field for activation, the filed is : +357 xxxxxxxxxxx
xxxxxx is the mobile number.
Field details: android.widget.EditText1 - +357
I cannot set text on this field. when I record my test case i don’t have any error but when i am doing the action on this field the mobile number is not written.
Can some help me?

Also when I tried to run my scenario I had the following error. Thank you

04-11-2019 11:34:25 AM Test Cases/MFS Activation 1

Elapsed time: 58.392s

Test Cases/MFS Activation 1 FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to set text ‘10000001’ of object ‘Object Repository/android.widget.EditText1 - 357’
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:48)
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.SetTextKeyword.setText(SetTextKeyword.groovy:65)
at com.kms.katalon.core.webui.keyword.builtin.SetTextKeyword.execute(SetTextKeyword.groovy:37)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.setText(WebUiBuiltInKeywords.groovy:950)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$setText.call(Unknown Source)
at MFS Activation 1.run(MFS Activation 1:21)
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:331)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:322)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:301)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:293)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:227)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1554971660291.run(TempTestCase1554971660291.groovy:21)

Hi Dimitrios,

If it is not working on SetText try using Sendkeys

Mobile.sendKeys(findTestObject("Your_object"), "Your input")

Hope that helps. . . .:smiley:

Hello Arnel,
Thanks for your reply. I tried your solution but it didn’t work. The only difference is that the step now is completed succsfully but the data didn’t enter on the application in order to continue.
Thank you

Hi @dimitrios.d,

Sometimes you need to tap the text input field to activate the keyboard. Can you try:

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

int timeout = 10
def inputField = findTestObject('Object Repository/android.widget.EditText1 - 357')
Mobile.tap(inputField, timeout)
Mobile.sendKeys(inputField, '10000001')

Hope this helps,

Chris

Hello, the same behavior. The step completed successfully but didn’t enter the text on the field.
Any other ideas?

Hi @dimitrios.d,

I’ve sometimes seen this when a custom input field is used. If possible, could you please share a screenshot of the screen right before you’re trying to enter the text? Could you also share the properties of the Test Object in the Object Repository that you’re trying to enter text into?

Thanks,

Chris

Hello Chris,
I found a solution, i search from internet and i found the commands to enter the text using the keyboard.
Thaank a lot for your time.

1 Like

Hi @dimitrios.d,

Glad you got it working! Could you please share your solution so that other people who encounter this issue can see it?

Thanks,

Chris

I find a solution fro this issues. I run the commands to use the kyebord.
please see below my solution
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory as MobileDriverFactory
import io.appium.java_client.android.AndroidDriver as AndroidDriver
import io.appium.java_client.android.AndroidKeyCode as AndroidKeyCode

Mobile.tap(findTestObject(‘mobile activation’), 0)

AndroidDriver<?> driver = MobileDriverFactory.getDriver()

driver.pressKeyCode(AndroidKeyCode.KEYCODE_1)

driver.pressKeyCode(AndroidKeyCode.KEYCODE_0)

driver.pressKeyCode(AndroidKeyCode.KEYCODE_0)

driver.pressKeyCode(AndroidKeyCode.KEYCODE_0)

driver.pressKeyCode(AndroidKeyCode.KEYCODE_0)

driver.pressKeyCode(AndroidKeyCode.KEYCODE_0)

driver.pressKeyCode(AndroidKeyCode.KEYCODE_0)

driver.pressKeyCode(AndroidKeyCode.KEYCODE_1)

3 Likes

I have the same problem but this script is not working on my side. Any solution?

Thank You Sir

Hi, I am new in katalon, I have tried this solution but it’s not working.

Did you add/set anything outside the script?

Thank You

find below what i have add

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 com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords 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
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory as MobileDriverFactory
import io.appium.java_client.android.AndroidDriver as AndroidDriver
import io.appium.java_client.android.AndroidKeyCode as AndroidKeyCode

1 Like

Hello sir,

Here is the screenshot when I applied your solution

the pressKeyCode does not identified

Thank You,
Heaven

Hi @heavenmojica,

The Groovy editor doesn’t recognize this method but it’s OK if you run the test.

Thanks

1 Like

Hi Sir @duyluong

I tried to run with the underlined pressKeyCode and it’s working now, it types the 101 value but why the pressKeyCode underlined?

Hi @heavenmojica,

It’s good that you recognized the underlined code as a potential problem!

pressKeyCode is underlined because the editor can’t find a direct reference to the function. I’m guessing it’s because of the way that the AndroidDriver class and its underlying libraries are imported. It’s nothing to be concerned about in this case, but definitely something to keep in mind when writing code in the future.

Hope this helps,

Chris

1 Like

Thank You sir @Chris_Trevarthen , it helps me a lot

1 Like

Thanks this helped me lots trying to enter a PIN through the Android keyboard.

Tried different methods to enter text into an object but still its taking more than an hour even its failing to enter the text. I had initialized the appium driver also but couldn’t find any solution. Please give me any other chances of sending values for mobile apps.

Thanks n Regards
Vinay

Yeah i have tried this too. Still the same issue occurring