在Android环境,可以使用driver.current_activity来获取当前应用的包名/界面名,但是在iOS环境下发现不行,报错 "Method has not yet been implemented"
查了下官网,发现确实不支持iOS,官网地址:Current Activity - Appium
我们可以使用Appium的Get App State来获取应用程序状态,具体用法如下:
返回的结果说明:
0 is not installed. 1 is not running. 2 is running in background or suspended. 3 is running in background. 4 is running in foreground.