Android UiAutomator - 检测应用程序是否处于 uiautomator 模式

标签 android testing android-uiautomator

我有一个正在购买产品的应用程序。在 uiautomation 测试期间,我想测试整个 View ,但不希望它实际购买。

如果设备在 ui-automator 模式下运行,如何检查测试应用程序?

最佳答案

您必须在每次测试之前添加一个系统属性,并且在每次测试之后,您必须重置该标志。

//in setup            
execCommand(uiDevice, "setprop uiautomation.mode true");
//in teadDown
execCommand(uiDevice, "setprop uiautomation.mode false");

关于Android UiAutomator - 检测应用程序是否处于 uiautomator 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36197142/

相关文章:

Android strings.xml 资源 - 阿拉伯语和动态格式化字符串

javascript - Protractor 剑道组合框

php - 有没有办法在 PHPUnit 中断言文件不为空?

appium - 有什么办法可以自动从appium扫描条形码吗?

java - Android自定义数字时钟,while循环运行出错 "Unhandled exception type InterruptedException"

android - 创建 AlertDialog 时会触发什么方法?

android - 音频流和获取幅度以同时绘制波形

PHPunit:我可以模拟我测试的类吗?

Android UIAutomator 如何检查手机或平板电脑

java - 使用 uiautomator 运行一系列测试