首页 新闻 会员 周边

appium+python 切入 webview 时报错 , 换成原生控件登录时使用 clear 然后 send_keys 实现账号密码输入时又会先在文本框点击 2 次,在第 3 次点击时才会执行输入,导致循环输入时第二次输入参数错误

0
悬赏园豆:50 [待解决问题]

因为我的app是混合的,可以直接用原生控件登录,也可以进入webview再登录;如果先进入webview再登录的话,不知道为什么运行脚本时每次运行到切入webview时就有80%概率报以下错误:(只有偶尔时才能运行正常);当正常进入webview后调用send_keys可以正常输入。

> info: JSONWP Proxy: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.chang.cloudtrip","androidUseRunningApp":true,"androidDeviceSerial":"127.0.0.1:62001"}}} > info: JSONWP Proxy: Got response with status 200: {"sessionId":"8cbf6d90c58f490ab85fad251dbc5519","status":13,"value":{"message":"unknown error: Device 127.0.0.1:62001 is not online\n (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514... > info: JSONWP Proxy: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.chang.cloudtrip","androidUseRunningApp":true,"androidDeviceSerial":"127.0.0.1:62001"}}} > info: JSONWP Proxy: Got response with status 200: {"sessionId":"5c2ecabd6d721e52429e9202c906a2da","status":13,"value":{"message":"unknown error: Device 127.0.0.1:62001 is not online\n (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514... > info: JSONWP Proxy: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.chang.cloudtrip","androidUseRunningApp":true,"androidDeviceSerial":"127.0.0.1:62001"}}} > info: JSONWP Proxy: Got response with status 200: {"sessionId":"da4c6824365929d94ccfc0199e0e70af","status":13,"value":{"message":"unknown error: Device 127.0.0.1:62001 is not online\n (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514... > info: JSONWP Proxy: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.chang.cloudtrip","androidUseRunningApp":true,"androidDeviceSerial":"127.0.0.1:62001"}}} > info: JSONWP Proxy: Got response with status 200: {"sessionId":"c080819aa6c300568b3ca4101d6ee2aa","status":13,"value":{"message":"unknown error: Device 127.0.0.1:62001 is not online\n (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514... > info: Chromedriver: Changed state to 'stopped' > warn: Chromedriver for context WEBVIEW_com.chang.cloudtrip stopped unexpectedly > warn: Chromedriver quit unexpectedly, but it wasn't the active context, ignoring > error: Chromedriver: Chromedriver exited unexpectedly with code null, signal SIGTERM > error: Chromedriver: Error: An unknown server-side error occurred while processing the command. (Original error: unknown error: Device 127.0.0.1:62001 is not online > (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 10.0 x86_64)) > at JWProxy.command$ (lib/proxy.js:133:15)

 

如果我直接用原生控件登录,不切入webview;代码就不会报以上错误。但是又出现调用clear和send_keys实现账号密码输入时会先在文本框点击2次,在第3次点击时才会执行输入,因此在循环输入时,后面的输入会先点击两次,此时光标会点击到参数的中间部分(比如输入1234567后,再次输入abcde时会先把光标点击到1和2之间,然后从1后面开始输入。导致输入的参数多了个1(变成了1abcde);

我试了去掉clear,直接send_keys也一样会点击到第3次才输入(注:我直接写一个简单的输入,不使用任何封装或者调用其他方法仍存在该问题),不知道哪位大神遇到过该问题或知道原因。麻烦帮忙看看,该怎么解决啊。实在不知道该怎么办了,困扰好久了。网上也没搜到该问题
换了其他app仍存在调用send_keys时多次点击再输入的问题

 

appium日志:

 info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"xpath","selector":"//android.widget.LinearLayout[contains(@index,3)]","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//android.widget.LinearLayout[contains(@index,3)]","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding //android.widget.LinearLayout[contains(@index,3)] using XPATH with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"Could not find an element using supplied strategy. ","status":7}
info: [debug] Condition unmet after 29ms. Timing out.
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"Could not find an element using supplied strategy. "},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: <-- POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element 500 65.305 ms - 230 
info: --> POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element {"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f","using":"xpath","value":"//android.widget.EditText[contains(@index,2)]"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"xpath","selector":"//android.widget.EditText[contains(@index,2)]","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//android.widget.EditText[contains(@index,2)]","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding //android.widget.EditText[contains(@index,2)] using XPATH with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.EditText, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":{"ELEMENT":"9"},"status":0}
info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"9"},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: <-- POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element 200 79.003 ms - 87 {"status":0,"value":{"ELEMENT":"9"},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: --> POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element/9/value {"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f","value":["1","5","8","8","4","6","8","6","3","5","5"],"id":"9"}
info: [debug] Pushing command to appium work queue: ["element:setText",{"elementId":"9","text":"15884686355","replace":false,"unicodeKeyboard":true}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:setText","params":{"elementId":"9","text":"15884686355","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] Using element passed in.
info: [debug] [BOOTSTRAP] [debug] Attempting to clear using UiObject.clearText().
info: [debug] [BOOTSTRAP] [debug] Sending plain text to element: 15884686355
info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: <-- POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element/9/value 200 6009.342 ms - 76 {"status":0,"value":true,"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}
info: --> POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element {"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f","using":"xpath","value":"//android.widget.EditText[contains(@index,3)]"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"xpath","selector":"//android.widget.EditText[contains(@index,3)]","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//android.widget.EditText[contains(@index,3)]","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding //android.widget.EditText[contains(@index,3)] using XPATH with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.EditText, INSTANCE=1]
info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"10"},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: <-- POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element 200 27.095 ms - 88 {"status":0,"value":{"ELEMENT":"10"},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":{"ELEMENT":"10"},"status":0}
info: --> POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element/10/value {"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f","value":["d","1","2","3","4","5","6","7"],"id":"10"}
info: [debug] Pushing command to appium work queue: ["element:setText",{"elementId":"10","text":"d1234567","replace":false,"unicodeKeyboard":true}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:setText","params":{"elementId":"10","text":"d1234567","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] Using element passed in.
info: [debug] [BOOTSTRAP] [debug] Attempting to clear using UiObject.clearText().
info: [debug] [BOOTSTRAP] [debug] Sending plain text to element: d1234567
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}
info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: <-- POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element/10/value 200 6006.277 ms - 76 {"status":0,"value":true,"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: --> GET /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/window/current/size {}
info: [debug] Pushing command to appium work queue: ["getDeviceSize"]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDeviceSize","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDeviceSize
info: [debug] Responding to client with success: {"status":0,"value":{"width":720,"height":1280},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: <-- GET /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/window/current/size 200 8.495 ms - 99 {"status":0,"value":{"width":720,"height":1280},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":{"width":720,"height":1280},"status":0}
info: --> GET /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/window/current/size {}
info: [debug] Pushing command to appium work queue: ["getDeviceSize"]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDeviceSize","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDeviceSize
info: [debug] Responding to client with success: {"status":0,"value":{"width":720,"height":1280},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: <-- GET /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/window/current/size 200 3.636 ms - 99 {"status":0,"value":{"width":720,"height":1280},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":{"width":720,"height":1280},"status":0}
info: --> POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element {"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f","using":"id","value":"com.chang.cloudtrip:id/safecenter"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"No element found","status":7}
info: [debug] Condition unmet after 50ms. Timing out.
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"No element found"},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: <-- POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element 500 51.061 ms - 195 
info: --> POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element {"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f","using":"id","value":"com.chang.cloudtrip:id/safecenter"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"No element found","status":7}
info: [debug] Condition unmet after 82ms. Timing out.
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"No element found"},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: <-- POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element 500 84.224 ms - 195 
info: --> POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element {"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f","using":"id","value":"com.chang.cloudtrip:id/safecenter"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"No element found","status":7}
info: [debug] Condition unmet after 535ms. Timing out.
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"No element found"},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: <-- POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element 500 538.762 ms - 195 
info: --> POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element {"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f","using":"id","value":"com.chang.cloudtrip:id/safecenter"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"No element found","status":7}
info: [debug] Condition unmet after 71ms. Timing out.
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"No element found"},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: <-- POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element 500 72.034 ms - 195 
info: --> POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element {"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f","using":"id","value":"com.chang.cloudtrip:id/safecenter"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"No element found","status":7}
info: [debug] Condition unmet after 16ms. Timing out.
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"No element found"},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: <-- POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element 500 16.750 ms - 195 
info: --> POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element {"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f","using":"id","value":"com.chang.cloudtrip:id/safecenter"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"No element found","status":7}
info: [debug] Condition unmet after 16ms. Timing out.
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"No element found"},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: <-- POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element 500 17.586 ms - 195 
info: --> POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element {"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f","using":"id","value":"com.chang.cloudtrip:id/safecenter"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"No element found","status":7}
info: [debug] Condition unmet after 62ms. Timing out.
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"No element found"},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: <-- POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element 500 62.818 ms - 195 
info: --> POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element {"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f","using":"id","value":"com.chang.cloudtrip:id/safecenter"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"No element found","status":7}
info: [debug] Condition unmet after 28ms. Timing out.
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"No element found"},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: <-- POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element 500 28.403 ms - 195 
info: --> POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element {"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f","using":"id","value":"com.chang.cloudtrip:id/safecenter"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.chang.cloudtrip:id/safecenter","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
info: [debug] [BOOTSTRAP] [debug] Finding com.chang.cloudtrip:id/safecenter using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.chang.cloudtrip:id/safecenter]
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"No element found","status":7}
info: [debug] Condition unmet after 61ms. Timing out.
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"No element found"},"sessionId":"f675851b-eea5-4743-bcf5-49255d1cce2f"}
info: <-- POST /wd/hub/session/f675851b-eea5-4743-bcf5-49255d1cce2f/element 500 62.969 ms - 195
小小测试的主页 小小测试 | 初学一级 | 园豆:154
提问于:2017-08-27 13:34
< >
分享
所有回答(1)
0

可以提供下被测手机安卓系统和appium版本吗

看报错情况,全篇主要是2个:

1 message":"unknown error: Device 127.0.0.1:62001 is not online 连不上设备

2 message":"An element could not be located on the page using the given search parameters 找不到元素

解决思路:

登录建议不需要切webview再登录。其它情况除非需要用到webview界面信息必须要切换之外,能不切就不切。

ycyzharry | 园豆:25653 (高人七级) | 2017-08-28 09:10

appium版本:1.4.16.1

手机是用的夜神模拟器:android 4.4.2

之前一直用这个环境,都没问题

另外,如果直接用原生控件登录的话,调用clear和sendkeys的时候会先点击文本框两次,第三次才会输入。这样的话会导致再次输入的时候,光标会定位到几个字符之间。就造成只有第一次输入时正确的,后面输入内容全都会错

支持(0) 反对(0) 小小测试 | 园豆:154 (初学一级) | 2017-08-28 09:25

@小小测试: 连一台真实安卓手机测试

支持(0) 反对(0) ycyzharry | 园豆:25653 (高人七级) | 2017-08-28 09:50

@ycyzharry: 没出之前在三星GALAXY S4(android5.x的版本)上跑过没问题;出问题后又在这个真机上跑过,也跟模拟器一样,都会先点击两次再输入。

支持(0) 反对(0) 小小测试 | 园豆:154 (初学一级) | 2017-08-28 09:56

@小小测试: 尽量不用模拟器 在真机上多试试

支持(0) 反对(0) ycyzharry | 园豆:25653 (高人七级) | 2017-08-28 10:05
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册