Skip to content

appium 2.0 + 版本使用了noReset 参数之后无法启动app或者不能关闭app的解决方案

appium 2.0 + noReset 参数于1.0+版本的表现差异

在启动参数设置这些时,可能会出现不会调起app,然后在teardown的时候加上了 driver.quit()也无法关闭app

        caps = {}
        # 设置 app 安装平台
        caps["appium:platformName"] = "Android"
        # 设置 app 安装平台的版本
        caps["appium:platformVersion"] = "6"
        # 设备的名字
        caps["appium:deviceName"] = "MuMu"
        # 设置driver
        caps["appium:automationName"] = "UiAutomator2"
        # 设置 app 的包名
        caps["appium:appPackage"] = "com.tencent.wework"
        # 设置 app 启动页
        caps["appium:appActivity"] = ".launch.LaunchSplashActivity"
        # 不清空缓存
        caps["appium:noReset"] = True

解决方案,在参数上再追加以下两个参数。

# 设置以下两个参数来控制启动app和关闭掉app
caps["appium:forceAppLaunch"] = True
caps["appium:shouldTerminateApp"] = True

参考

app does not launch if noResent is true · Issue #19460 · appium/appium · GitHub

原文链接:https://ceshiren.com/t/topic/29190