在使用appium自动化安卓设备或者ios设备app时,很可能遇到app本身crash的情况,如果不做存活检测的话,很可能app已经崩溃,client程序却仍在执行。
搜索结果的建议是:
https://discuss.appium.io/t/how-to-detect-app-crash-in-reality/498/6
https://github.com/appium/appium/issues/1147
https://testerhome.com/topics/230
实际操作可尝试方法:
driver.current_activity in self.desired_caps['appActivity']
或者监测appium的log日志等事件触发