将appium版本升级到1.6.3后,我遇到了这个问题。每当我使用driver.launchApp();
命令时,就会清除应用数据,因此我无法执行下一个案例。
我尝试设置以下所需功能,但每当我尝试启动应用时,它仍会清除应用数据。
capabilities.setCapability("noReset", "true");
所以场景是,我登录到应用程序然后重新启动应用程序和appium清除应用程序数据,然后再次出现不应出现的登录屏幕。
以下是我们可以清楚地看到appium正在清除应用数据的日志。
[debug] [ADB] Running 'C:\Users\Vinod\AndroidSDK\platform-tools\adb.exe' with args: ["-P",5037,"-s","079a1ea4d037eeb7","shell","am","force-stop","PACKAGENAME"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Vinod\AndroidSDK\platform-tools\adb.exe' with args: ["-P",5037,"-s","079a1ea4d037eeb7","shell","pm","clear","PACKAGENAME"]
[debug] [ADB] Device API level: 23
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running 'C:\Users\Vinod\AndroidSDK\platform-tools\adb.exe' with args: ["-P",5037,"-s","079a1ea4d037eeb7","shell","am","start","-W","-n","PACKAGENAME/.ui.SplashActivity","-S","-a","android.intent.action.MAIN","-c","android.intent.category.LAUNCHER","-f","0x10200000"]
答案 0 :(得分:1)
您需要在功能中添加以下代码
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("noReset", "true");
cap.setCapability("fullReset", "false");
对我有用。
答案 1 :(得分:0)
确保已设置此功能: 虽然此功能的默认值为false,但仍值得一试。
capabilities.setCapability("fullReset", "false");
如果它不起作用,请提供项目的代码示例。
答案 2 :(得分:0)
如果删除driver.launchApp();声明那么它应该是完美的。
您无需调用此方法,因为在使用功能启动服务器时,appium会为您执行此操作。
答案 3 :(得分:0)
希望您能找到解决方案。如果没有,您可以尝试一下。 Appium版本1.14.2
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.FULL_RESET, "False");
cap.setCapability(MobileCapabilityType.NO_RESET, "True");