仅在api级为28的Android设备上。 单击微调框后尝试匹配文本失败。
两种方法,一种是寻找不是活动的窗口,第二种是寻找弹出菜单:
...
// 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 <= 27
正常工作有人知道为什么它在28上不起作用吗?谢谢。