Unable to set text when record mobile

Hi guys,

I’m facing this error when i try to set text

Could you guys help me?

Thank you

Hi @Raka_Aditoro_Faturah,

From the error, it looks like you’re trying to set the text on an element that isn’t really a text input field. Could you share what the layout of the screen looks like without the error dialog in the way? You might want to try setting the text on one field deeper than you are trying now (or one field up).

If that doesn’t work, you might need to use either the MobileBuiltInKeywords.sendKeys() function or set your test to click on the keypad buttons themselves.

Hope this helps,

Chris

Hi Chris,

Thanks for your reply
I’ve tried your suggestion using Mobile.sendKeys() but still cannot set text on the element.

Here is the layout of the screen

and here are the attribute of the element

Let me know if you found any solution for my problem.
Thank you.

Hi @Raka_Aditoro_Faturah,

This looks like a custom form interface and it doesn’t look like there is a typical text entry field. Since the keypad is open, we might be able to interact with it directly:

import io.appium.java_client.android.AndroidDriver
import io.appium.java_client.android.AndroidKeyCode

AndroidDriver<?> driver = (AndroidDriver<?>) MobileDriverFactory.getDriver()

driver.pressKeyCode(AndroidKeyCode.KEYCODE_NUMPAD_1)
driver.pressKeyCode(AndroidKeyCode.KEYCODE_NUMPAD_2)
driver.pressKeyCode(AndroidKeyCode.KEYCODE_NUMPAD_ENTER)

Where the keypad keys are KEYCODE_NUMPAD_0 - KEYCODE_NUMPAD_9.

Hope this helps,

Chris