Cannot Set Text on field

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

Hi @vinaykumar.ts,

When you tap the text field first, is the keyboard opening at all?

Can you share more info about what version of Appium and Katalon you’re using? What version of the Android SDK do you have and what device model and Android version is it running?

Could you also share a screenshot of the form where you’re trying to enter text?

Thanks,

Chris

Hey @Chris_Trevarthen ,
When I tap on the object sometimes keyboard opens.

I’m using Katalon 6.2.2 and tried with 6.3.3 also
Appium 1.8.1
java 1.8

Device: samsung M20 and Android version 8.1.0(This issue is happening for all the devices and version that i have tested)

Set text is stuck at the Landing page of the application while entering email

Hope you got more info about issue.

And also want to know that will katalon support PWA apps ?

Thanks
Vinay

Hi @vinaykumar.ts,

So the keyboard is showing sometimes, but there is no text set in the form field, is that correct?

Could you please share the log file?

I’m also curious to see what Appium thinks is on the screen at the time when the keyboard is open. Could you follow the steps in this post to create an XML file of the contents of the screen: Unable to click/tap on a button in Android WebView

As for PWA apps, from what I am reading, you can test them the same way you would test a website, just using the mobile device as the browser. This may mean using the WebUI functions instead of Mobile.

– Chris