遇到一个比较怪异的错误,请大神们帮忙看看!
现象:
在 MI3 真机上成功启动 APIdemo app 后,直接通过 find elements by xpath 查找元素,报错:remote object '/data/local/tmp/local/tmp/dump.xml' does not exist!有时是: remote object '/data/local/tmp/dump.xml' does not exist!
如果先通过其他方式查找一次元素,例如 find elements by class name,然后再执行 find elements by xpath,就可以成功执行。
log 分析:
查看 log 信息,发现 find elemens by xpath 失败的时候,dumpWindowHierarchy 返回的是 false,如下:
debug: Pushing command to appium work queue: ["dumpWindowHierarchy"]
debug: [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"dumpWindowHierarchy","params":{}}
debug: [BOOTSTRAP] [debug] Got command of type ACTION
debug: [BOOTSTRAP] [debug] Got command action: dumpWindowHierarchy
debug: [BOOTSTRAP] [debug] Returning result: {"value":false,"status":0}
debug: transferPageSourceXML command: "E:\android-sdk-windows\platform-tools\adb.exe" -s e075b5e6 pull /data/local/tmp/local/tmp/dump.xml "I:\Users\lana\AppData\Local\Temp\11481-1860-dch0jq.xml"
info: <-- POST /wd/hub/session/30d66762-61ab-430c-b2f9-c4f86bf79e95/elements 500 95.545 ms - 396
error: remote object '/data/local/tmp/local/tmp/dump.xml' does not exist
通过 adb shell 查看,data/local/tmp 或者 data/local/tmp/local/tmp 目录下确实没有 dump.xml 文件
疑问:
1、 什么原因会导致 dump.xml 文件创建失败?
2、find elements by class name 之后再 find elements by xpath 为什么又可以成功了?
3、为什么每次获取的 dataDir 路径会不一样,有时是/data,有时又是/data/local/tmp