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.
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”);
@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.
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