【发布时间】:2018-09-05 08:09:35
【问题描述】:
这仅适用于 API 级别 28 的 Android 设备。 单击微调器后尝试匹配文本失败。
两种方法,一种寻找不是activity的窗口,第二种寻找弹出菜单:
...
// Look for text "Green" in the menu
onView(withId(getFieldId(COLOR_ID))).perform(click());
onView(withText("Green"))
.inRoot(withDecorView(not(is(rule.getActivity().getWindow().getDecorView())))) // Look for popup menu
.perform(click());
// Second spinner, Look for the text "Medium"
onView(withId(getFieldId(SIZE_ID))).perform(click());
onView(withText("Medium")).inRoot(RootMatchers.isPlatformPopup()).perform(click());
...
两者都可以使用设备 API
知道为什么这不适用于 28 吗?谢谢。
【问题讨论】:
标签: android testing android-espresso