代码是这样子的:

userEditField = dr.find_element_by_id('com.hujiang.hjclass:id/etLoginUsername')
userEditField.send_keys("kuroko1")
sleep(2)

日志里执行到这里的时候:

info: [debug] [BOOTSTRAP] [debug] Clearing text not successful using selectAllDelete now trying to send delete keys.
info: [debug] [BOOTSTRAP] [debug] Finding methods on class: class com.android.uiautomator.core.UiAutomatorBridge
info: [debug] [BOOTSTRAP] [debug] Clearing text not successful falling back to UiAutomator method clear
info: [debug] [BOOTSTRAP] [debug] clearText not successful, continuing with setText anyway
info: [debug] [BOOTSTRAP] [debug] Sending plain text to element: 沪江用户名/邮箱/手机kuroko1
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}

可以看到执行到 send_keys 的时候,就提示 Clearing text not successful 了,然后 sending 进去的 text 是:

Sending plain text to element: 沪江用户名/邮箱/手机kuroko1

实际上在手机上看到是无任何输入操作的。
没弄明白是什么问题引起的?


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