如何使Espresso点击一个长选项菜单中尚未可见的(选项)菜单项?
打开选项菜单很容易:
openActionBarOverflowOrOptionsMenu( getInstrumentation().getTargetContext());
我尝试使用scrollTo,但它没有成功:
onView( withText("Option menu item text")).perform( scrollTo(), click());
onView( withText( R.id.optionMenuId)).perform( scrollTo(), click());
onView( withId( is( R.id.appOptionMenu))).perform( swipeDown()); // where SwipeDown is a simple utility method on GeneralSwipeAction.
onData( anything()).inAdapterView( withId(R.id.wpeOptionMenu)).atPosition( 12).perform(click()); // I guess because it is not an adapter
你有好的解决方案吗?