Wrong text being input in Android device

I am using ‘sendKeys’ function to input text in android device.

However, sometimes it inputs wrong text. This happens usually when it is trying to input an IP address.

I am using appium v1.5.3, device - Moto G2, OS - v6.0

Code being used :

if (element != null) {

element is of type ‘MobileElement’

P.S. - This is also used to happen when I was using UIAutomator.

Any idea what’s going wrong here? This is not 100% reproducible. Happens 2/5.

try setValue. it is much more reliable. just had same.

I don’t see a ‘setValue’ function for MobileElement class or AndroidElement class.

The OS in question here is android.

this is valid for IOS only.

Exactly. Any help in Android? Not getting anything around this anywhere. I hope I am not the only one with this problem.

i made workaround for critical inputs like username in a way enter data, check data, set again if incorrect.

Agreed. I am doing the same. However, I would love to know why it inputs the wrong text? Is it device dependent? Or is it UIAutomator’s fault? Or is it an issue with the way OS is designed/call to input text is being made.
Can we fix it at the grass root level?

…and most importantly, has anyone else encountered this as well?

Any of these are possible, but based on gut feeling, I believe it’s likely device dependent and the way the device’s OS is built (which, in the Android world, usually refer to the device as a whole since OS and hardware are closely tied together). Does sendKeys send the wrong text on all the devices you have tried? I might recommend enabling Appium’s Unicode keyboard. There’s a “unicodeKeyboard” capability you can use when setting up your desired capabilities object: http://appium.io/slate/en/master/?ruby#android-only

1 Like

I’m not sure if this is the same problem, but some of my scripts clear out a search box before entering new criteria, and sometimes instead of clearing out the text, it selects some or all of the text, then backspaces a few times, then enters the new criteria, resulting in the wrong data being sent since not all of the original text was cleared out. I see this on my Galaxy S6 about 30% of the time.

I have seen it on multiple devices. And it does happen 2/5 times. It usually happens on Motorola device, which boast stock android OS. I will give a shot to ‘unicodeKeyboard’. Lets see if that helps. Thanks!

I haven’t seen this behavior. Appium might be trying to clear the text before typing again. You can always delve in the source code and check :slight_smile: