相关疑难解决方法(0)

单击有时在溢出菜单中的菜单项

目前点击溢出菜单中某些设备上的菜单项我正在执行以下操作:

fun invokeMenu(@IdRes menuId: Int, @StringRes menuStringRes: Int) {
 try {
  onView(withId(menuId)).perform(click())
 } catch (nmv: NoMatchingViewException) {
  openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().targetContext)
  onView(withText(menuStringRes)).perform(click())
 }
}
Run Code Online (Sandbox Code Playgroud)

但我正在寻找一种更好的方法 - 理想情况下,我必须知道菜单ID.你如何在浓咖啡测试中做到这一点?

android optionmenu android-espresso

4
推荐指数
1
解决办法
462
查看次数

标签 统计

android ×1

android-espresso ×1

optionmenu ×1