UiAutomator上的最新应用

问题描述 投票:3回答:3

我现在正在使用Android UiAutomator在我的Android应用上进行UI测试。我的应用程序具有要求用户验证电子邮件才能继续的功能,因此我尝试按以下方式进行操作:到达该功能后-> getUiDevice.pressHome->浏览器->尝试登录电子邮件-> PressHome- >按“ RecentApps”,然后我停留在这里,我无法按我的“ Apps”再次返回。我尝试通过单击“我的应用程序”图标尝试另一种方法,但它会再次启动我的应用程序,而不是以前的状态。有人可以建议我解决这个问题吗?任何帮助表示赞赏。

提前感谢。

android android-uiautomator
3个回答
5
投票
UiObject appBackground = new UiObject(new UiSelector().description("ABC")); appBackground.click();

它没有通过'uiautomatorviewer'命令显示任何描述,但这对我有用。


0
投票
// Take all image view by class type and click by instance no. new UiObject(new UiSelector().className("android.widget.ImageView").instance(3)).click();

您需要计算最近的应用程序图像视图的实例号。在最近的应用滚动视图中不是应用图标图像。请尝试这个。谢谢。


0
投票
如果您是倒数第二个运行的应用程序,则可以执行x:0和y:device.displayHeight/2

我没有在很多操作系统上测试过,只有9个。

© www.soinside.com 2019 - 2024. All rights reserved.