android - 如何阻止appium清除Android应用数据?

标签 android selenium automation adb appium

将我的 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"]

最佳答案

您需要在功能中添加以下代码

DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("noReset", "true");
cap.setCapability("fullReset", "false");

它对我有用。

关于android - 如何阻止appium清除Android应用数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42246622/

相关文章:

java - 如何使用 Java 使用 Selenium WebDriver 实现 PhantomJS

javascript - WebDriver 操作的工作原理

database - vertica 安装失败并出现 ssh 错误

python - 如何使用Python将csv行循环到selenium元素?

python - 如何使用 AntiCaptcha 解决 FunCaptcha/RotateCaptcha?

java - 如何将新项目导入perforce

android - 为什么 FFMPEG 命令在棉花糖和 Lollipop 中不起作用?

android - 将 iPhone 图形移植到 Android 时有经验法则吗?

java - 找不到 Activity 异常

android - 在两个 Kotlin 中拆分字符串