有没有人遇到 appium1.3.4.1 版 sendkey 的时候删除原值再 send 时,文本框的最后结果为:原值 +send 值的情况
例如:日历插件输入框中日期为 2015-03-19,要输入 2015-03-20,先 clear 文本框,再 sendkey("2015-03-20")。其结果为 2015-03-192015-03-20。查看 appium 日志也显示发送的有问题。Sending plain text to element: 2015-03-192015-03-20
在 1.2.4 版无这样的情况,但是 1.2.4 版 sendkey 速度非常慢。
代码:

driver.SendKeyByElement(pageOrderQuery.text_order_depdate,2015-03-20);

日志:

> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: find
> info: [debug] [BOOTSTRAP] [debug] Finding com.*.*.*:id/custom_date_input_edittext_edittext using ID with the contextId:  multiple: false
> info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.*.*.*:id/custom_date_input_edittext_edittext]
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":{"ELEMENT":"20"},"status":0}
> info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"20"},"sessionId":"4adf2a57-f5d7-4c32-9f2d-64621d825d7a"}
> info: <-- POST /wd/hub/session/4adf2a57-f5d7-4c32-9f2d-64621d825d7a/element 200 51.130 ms - 88 {"status":0,"value":{"ELEMENT":"20"},"sessionId":"4adf2a57-f5d7-4c32-9f2d-64621d825d7a"}
> info: --> GET /wd/hub/session/4adf2a57-f5d7-4c32-9f2d-64621d825d7a/element/20/text {}
> info: [debug] Pushing command to appium work queue: ["element:getText",{"elementId":"20"}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getText","params":{"elementId":"20"}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: getText
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"2015-03-19","status":0}
> info: [debug] Responding to client with success: {"status":0,"value":"2015-03-19","sessionId":"4adf2a57-f5d7-4c32-9f2d-64621d825d7a"}
> info: <-- GET /wd/hub/session/4adf2a57-f5d7-4c32-9f2d-64621d825d7a/element/20/text 200 575.271 ms - 84 {"status":0,"value":"2015-03-19","sessionId":"4adf2a57-f5d7-4c32-9f2d-64621d825d7a"}
> info: --> GET /wd/hub/session/4adf2a57-f5d7-4c32-9f2d-64621d825d7a/element/20/text {}
> info: [debug] Pushing command to appium work queue: ["element:getText",{"elementId":"20"}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getText","params":{"elementId":"20"}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: getText
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"2015-03-19","status":0}
> info: [debug] Responding to client with success: {"status":0,"value":"2015-03-19","sessionId":"4adf2a57-f5d7-4c32-9f2d-64621d825d7a"}
> info: <-- GET /wd/hub/session/4adf2a57-f5d7-4c32-9f2d-64621d825d7a/element/20/text 200 418.224 ms - 84 {"status":0,"value":"2015-03-19","sessionId":"4adf2a57-f5d7-4c32-9f2d-64621d825d7a"}
> info: --> POST /wd/hub/session/4adf2a57-f5d7-4c32-9f2d-64621d825d7a/element/20/value {"id":"20","value":["2015-03-20"]}
> info: [debug] Pushing command to appium work queue: ["element:setText",{"elementId":"20","text":"2015-03-20","replace":false,"unicodeKeyboard":true}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:setText","params":{"elementId":"20","text":"2015-03-20","replace":false,"unicodeKeyboard":true}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: setText
> info: [debug] [BOOTSTRAP] [debug] Attempting to clear using UiObject.clearText().
> info: [debug] [BOOTSTRAP] [debug] Updating class "class com.android.uiautomator.core.UiDevice" to enable field "mUiAutomationBridge"
> info: [debug] [BOOTSTRAP] [debug] Updating class "class com.android.uiautomator.core.UiAutomatorBridge" to enable field "mInteractionController"
> info: [debug] [BOOTSTRAP] [debug] Finding methods on class: class com.android.uiautomator.core.InteractionController
> info: [debug] [BOOTSTRAP] [debug] Clearing text not successful. Attempting to clear by selecting all and deleting.
> info: [debug] [BOOTSTRAP] [debug] Updating class "class com.android.uiautomator.core.UiDevice" to enable field "mUiAutomationBridge"
> info: [debug] [BOOTSTRAP] [debug] Updating class "class com.android.uiautomator.core.UiAutomatorBridge" to enable field "mInteractionController"
> info: [debug] [BOOTSTRAP] [debug] Finding methods on class: class com.android.uiautomator.core.InteractionController
> info: [debug] [BOOTSTRAP] [debug] Finding methods on class: class com.android.uiautomator.core.InteractionController
> info: [debug] [BOOTSTRAP] [debug] Finding methods on class: class com.android.uiautomator.core.InteractionController
> info: [debug] [BOOTSTRAP] [debug] Sending plain text to element: 2015-03-192015-03-20
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}
> info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"4adf2a57-f5d7-4c32-9f2d-64621d825d7a"}
> info: <-- POST /wd/hub/session/4adf2a57-f5d7-4c32-9f2d-64621d825d7a/element/20/value 200 13211.567 ms - 76 {"status":0,"value":true,"sessionId":"4adf2a57-f5d7-4c32-9f2d-64621d825d7a"}


↙↙↙阅读原文可查看相关链接,并与作者交流