SendKeys is clearing the text from editText1 while trying to insert into editText2 (individual pin textboxes)
See original GitHub issueThe problem
I have an app that asks the user to enter a pin code. The pin code consists of 4 different editText elements (editText1, editText2, etc…).
I am calling the .SendKeys(“1”) method for each editText item (IWebElement).
driver.FindElement(By.Id("com.myapp.androidphone:id/editText1")).SendKeys("1");
driver.FindElement(By.Id("com.myapp.androidphone:id/editText2")).SendKeys("1");
When I call the editText2.SendKeys(“2”) method, a call to the UiObject.ClearText() method is invoked and this wipes out my editText1 value. So essentially, i can never fill out all of the editText textboxes because each call for populating an editText is wiping out the previous textbox value.
Example: EditText1.SendKeys(“1”); (This populates the first pin number square). EditText2.SendKeys(“1”); (This populates the second pin number square, however it wipes out the first pin square).
So, is this a bug or am I using SendKeys incorrectly. Also, does anyone have any idea on how I can go about entering a value without clearing the previous field.
Environment
- Appium version: v1.5.0:
- Desktop: WIN 7 Pro
- Node.js version: v4.4.0
- Mobile platform/version under test: Android
- Real device or emulator/simulator: Emulator Nexus 5 API 19 (4.4.2)
- Appium CLI
Link to Appium logs
016-03-28 12:26:40:237 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.myapp.androidphone:id/editText1]
2016-03-28 12:26:40:238 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"ELEMENT":"25"},"status":0}
2016-03-28 12:26:40:239 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2016-03-28 12:26:40:240 - info: [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"25"}
2016-03-28 12:26:40:241 - info: [HTTP] <-- POST /wd/hub/session/361c5ace-ec8e-487e-a2d7-be57f086a9c7/element 200 14 ms - 88
2016-03-28 12:26:40:242 - info: [HTTP] --> POST /wd/hub/session/361c5ace-ec8e-487e-a2d7-be57f086a9c7/element/25/value
2016-03-28 12:26:40:243 - info: [MJSONWP] Calling AppiumDriver.setValue() with args: [["1"],"25","361c5ace-ec8e-487e-a2d7-be57f086a9c7"]
2016-03-28 12:26:40:244 - info: [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:setText","params":{"elementId":"25","text":"1","replace":false,"unicodeKeyboard":true}}
2016-03-28 12:26:40:247 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:setText","params":{"elementId":"25","text":"1","replace":false,"unicodeKeyboard":true}}
2016-03-28 12:26:40:251 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2016-03-28 12:26:40:251 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: setText
2016-03-28 12:26:40:251 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using element passed in.
2016-03-28 12:26:40:253 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Attempting to clear using UiObject.clearText().
2016-03-28 12:26:43:290 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Sending plain text to element: 1
2016-03-28 12:26:46:526 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":true,"status":0}
2016-03-28 12:26:46:526 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2016-03-28 12:26:46:527 - info: [MJSONWP] Responding to client with driver.setValue() result: true
2016-03-28 12:27:01:732 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.myapp.androidphone:id/editText2]
2016-03-28 12:27:01:748 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2016-03-28 12:27:01:749 - info: [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"26"}
2016-03-28 12:27:01:751 - info: [HTTP] <-- POST /wd/hub/session/361c5ace-ec8e-487e-a2d7-be57f086a9c7/element 200 43 ms - 88
2016-03-28 12:27:01:752 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"ELEMENT":"26"},"status":0}
2016-03-28 12:27:01:753 - info: [HTTP] --> POST /wd/hub/session/361c5ace-ec8e-487e-a2d7-be57f086a9c7/element/26/value
2016-03-28 12:27:01:755 - info: [MJSONWP] Calling AppiumDriver.setValue() with args: [["1"],"26","361c5ace-ec8e-487e-a2d7-be57f086a9c7"]
2016-03-28 12:27:01:759 - info: [debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:setText","params":{"elementId":"26","text":"1","replace":false,"unicodeKeyboard":true}}
2016-03-28 12:27:01:770 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:setText","params":{"elementId":"26","text":"1","replace":false,"unicodeKeyboard":true}}
2016-03-28 12:27:01:770 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2016-03-28 12:27:01:770 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: setText
2016-03-28 12:27:01:771 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using element passed in.
2016-03-28 12:27:01:772 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Attempting to clear using UiObject.clearText().
2016-03-28 12:27:05:310 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Sending plain text to element: 1
2016-03-28 12:27:08:203 - info: [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":true,"status":0}
2016-03-28 12:27:08:203 - info: [debug] [AndroidBootstrap] Received command result from bootstrap
2016-03-28 12:27:08:204 - info: [MJSONWP] Responding to client with driver.setValue() result: true
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
This sounds like a bug. I’m exploring locally. Thanks for reporting!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.