をクリックしますここではオプションメニューをクリックします:は、私はアクションバーを開いて最初の、エスプレッソを使用してテストを作っていエスプレッソとアクションバーにメニュー項目を
onView(withId(R.id.action_menu)).perform(click());
メニューレイアウトxmlには、id: "action_menu"というオプションがあります。
私はエラーを取得する:
android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id: ***.********.******.android.debug:id/action_menu
If the target view is not part of the view hierarchy, you may need to use Espresso.onData to load it from one of the following AdapterViews:android.support.v7.widget.ListPopupWindow$DropDownListView{43fd3f58 VFED.VC. .F...... 24,24-612,168}
私が使用して動作するように、このステップを得た:
onView(withText(R.string.action_report)).perform(click());
私もIDと間違って何が起こっているかを知っていただきたいと思います。
アイデア?
アイテムは本当にID =「@ + ID/action_menu」を持っていますか?それは、report_actionのように、より具体的である可能性があるというwithTextマッチャーから聞こえる。 – siger
こんにちはsiger、はいアイテムは 'android:id =" @ + id/action_menu "'というIDを持っていますが、エスプレッソはテキストでしか見つかりません。まだなぜか分からない... –