Android - sendKeys() function clicks/taps random elements in the page but does not enter text in the EditText element

Hello,

I have been stuck with this issue for a few days now.

I am executing a script which has to type some text in a search box present in the page.
When ever the sendKeys() command is executed, the control clicks/taps other elements (e.g. TextView element) in the page but does not type anything in the EditText element.

I am using
Appium Version 1.3.3
Android Version 4.4.2
(this behaviour is consistent on all android 4.4.2 devices)
I also tried to use the sendKeys function in the Appium Inspector, and the behaviour is consistent.

I have tried to insert text/type an alphabet using KeyCode - driver.sendKeyEvent(29).
But this also causes the same strange behaviour.

Please advice.

1 Like

facing the same issue.

Tried with Appium 1.3.4. The issue still exists.

get page source and verify that, there might be some elements with same name or class name

No, that is not the issue. There are not elements with the same ID in the page.
Also tapping on the textbox works perfectly fine. Only when i use the send keys command, this happens.
I have tried doing the same using appium UI where we first have to manually select element in the inspector and then execute send keys.
So the issue mentioned above is not it.

AppiumLogs.txt (15.0 KB)

I have uploaded the appium log file for the SendKeys command.

Hi poorvikamahesh,

Did u get any solution for this issue???

Thanks,
Nischal

Sorry Nischal Sinha, I have not yet received any solutions

try setValue() instead of SendKey() like: (MobileElement) driver.findElement(By some logic).setValue(“test”)

Hi Poorvikamahesh,

Have found solution for this issue…

I am also facing same issue with appium 3.4.1 for android using Java, it clicks and clear the edittext field but when sendkeys method execute it enter text in some other field.

Can any help me on this issue!!!

I would appreciate your help.

Thanks,
Dani

Try setValue() with Mobileelement

Hi Laknani.Nimesh,

Many thanks for your reply!!

Is setValue() implemented for Android device? As per this thread How to use .setText from AppiumDriver instead of .sendKeys from WendDriver or AndroidDriver? setValue() is only for iOS…

Thanks,
Dani

Actually i have used it with iOS not sure for Android. As per link provided by you, it will work with iOS only.

Use driver.hidekeyboard();, after passing sendkeys each time.