环境:Appium 3.2.0(Java) + Windows + Android Emulator
遇到的问题:
档持续运行 case 超过十几分钟之后,Appium server 会显示 press home button 然后自动退出应用,cases block 住了。日志如下:
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.cargosmart.BigSchedules:id/et_username","context":"","multiple":true}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding com.cargosmart.BigSchedules:id/et_username using ID with the contextId: multiple: true
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[RESOURCE_ID=com.cargosmart.BigSchedules:id/et_username]
info: [debug] [BOOTSTRAP] [debug] getElements selector:UiSelector[RESOURCE_ID=com.cargosmart.BigSchedules:id/et_username]
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (0)
info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=com.cargosmart.BigSchedules:id/et_username]
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (1)
info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[INSTANCE=1, RESOURCE_ID=com.cargosmart.BigSchedules:id/et_username]
info: [debug] Responding to client with success: {"status":0,"value":[{"ELEMENT":"2"}],"sessionId":"271c921b-b35a-41cc-8e78-01d88153dc44"}
info: <-- POST /wd/hub/session/271c921b-b35a-41cc-8e78-01d88153dc44/elements 200 149.315 ms - 89 {"status":0,"value":[{"ELEMENT":"2"}],"sessionId":"271c921b-b35a-41cc-8e78-01d88153dc44"}
info: --> POST /wd/hub/session/271c921b-b35a-41cc-8e78-01d88153dc44/element/2/value {"id":"2","value":["test01@cs.com"]}
info: [debug] Pushing command to appium work queue: ["element:setText",{"elementId":"2","text":"test01@cs.com","replace":false}]
info: [debug] Didn't get a new command in 60 secs, shutting down...
info: Shutting down appium session
info: [debug] Pressing the HOME button
info: [debug] executing cmd: "D:\android Dev\Android\Sdk\platform-tools\adb.exe" -s emulator-5554 shell "input keyevent 3"
Click Element 问题:通过 WebDriver 的方式查找 返回 WebElement,然后调用 WebElement 的 click,对于部分的元素,Click 操作不是在元素本身,而是发生在相邻近的元素上了,不知道大家在做的过程有没有遇到这类问题呢?