'sendKeys' appends the word 'Search' with my text

This is the code snippet I am Using

el = driver.findElementByClassName(“android.widget.EditText”);
el.sendKeys(“auto”);

the following is the console log

[HTTP] --> POST /wd/hub/session/41efa5fa-df90-4820-bb64-5d27c69251d3/element/1/value {"id":"1","value":["auto"]}
[debug] [MJSONWP] Calling AppiumDriver.setValue() with args: [["auto"],"1","41efa5fa-df90-4820-bb64-5d27c69251d3"]
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:setText","params":{"elementId":"1","text":"auto","replace":false,"unicodeKeyboard":true}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:setText","params":{"elementId":"1","text":"auto","replace":false,"unicodeKeyboard":true}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: setText
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using element passed in: 1
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Attempting to clear using UiObject.clearText().
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Could not check for hint text because the element is not focused!
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Clearing text not successful. Attempting to clear by selecting all and deleting.
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Sending plain text to element: Searchauto
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":true}
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [MJSONWP] Responding to client with driver.setValue() result: true

You can note that the driver is sending the text “Searchauto” to the element instead of “auto”.

Anyone faced similar issue? The same code snippet works perfectly in another search bar.

As this really seems a bug, please tell us which version are you using of appium. Thank you

((AndroidElement) el).setValue("auto");
((AndroidElement) el).replaceValue("auto");

Appium version 1.6.3
AndroidDriver version: 1.10.38
platformVersion: ‘7.0’(i.e., android 7)

Hi, What you are suggesting seems to be a workaround. I have already another workaround for my case. Anyway, Thanks

I wouldn’t consider this a bug. SendKeys is just like tapping on it and sending those keys immediately. If you want to clear what is there, you should add another step.

el = driver.findElementByClassName(“android.widget.EditText”);
el.Clear();
el.sendKeys(“auto”);

This will clear then type in auto

@kcinman11358
The text field is empty initially and I am sending the text ‘auto’ only. I have even tried el.clear() before sending keys, issue happens yet.

It might be possible that the Search is set as the default text. Not sure, why its not visible. Can you try the below approach to verify it ?

  1. Before typing the text in this field, put a hard wait of 15-20 seconds using Thread.sleep
  2. During this hard wait time, manually type some text in this field.
  3. Manually typing something would clear out the ‘Search’ text if it was the default value.
  4. Now, after this wait time is complete, your script would type ‘auto’ in the field.
  5. See if it still types Searchauto. Most probably, it would now set the value - auto.

If the value typed now is anything other than Searchauto then it means that Search was the default value.

I am facing the same issue as Bala. My text is appended with the text field name.

I am facing the same issue as well. In my case this is happening while sending keys to edit field of date picker. Send keys sends the old value appended with new value which ultimately doesn’t change the value on the date picker.

logs:
[AndroidBootstrap] Sending command to android: {“cmd”:“action”,“action”:“element:setText”,“params”:{“elementId”:“11”,“text”:“Aug”,“replace”:false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“element:setText”,“params”:{“elementId”:“11”,“text”:“Aug”,“replace”:false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: setText
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using element passed in: 11
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Attempting to clear using UiObject.clearText().
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Sending plain text to element: JanAug
[AndroidBootstrap] Received command result from bootstrap