java - Espresso : returning to application

标签 java android-espresso

我在 Espresso 中进行了测试,在测试结束时,我按下应用程序中的通话按钮,这会导致手机的拨号屏幕。

如何返回应用程序? 我想返回应用程序并从中注销。

pressBack(); 不执行任何操作。

如有建议,我们将不胜感激。

最佳答案

 UiDevice mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
mDevice.pressRecentApps();
mDevice.pressRecentApps();

我最终使用了UIAutomator。正是我所需要的。

关于java - Espresso : returning to application,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49340645/

相关文章:

java - Tomcat 7 卡在 Initializing Spring root WebApplicationContext

java - 如何高效地在java中实现这个scala操作

android - 使用 Gradle Spoon 插件在特定位置启动测试

android - Espresso/UIAutomator 测试 - 无法找到/关闭 "Save password with Autofill with Google"对话框

java - Android Espresso,如何继续执行 onLongClick 和 slideDown?

java - Jersey POST 端点在 Websphere 7 上失败

java - 如何访问 Java 调用程序的资源目录

java - Activity 在 UI 测试中永远不会变成请求状态

android - Espresso - 获取元素的文本

java - 这个excel方法在做什么?