Android espresso 访问第一行适配器中的 EditText
Android espresso accessing EditText in adapter in first row
我正在使用 Espresso 来测试我的应用程序。我有一个列表视图,其中包含一些数据。我想检查第一行中编辑文本的值。
我试过了:
onData(withId(R.id.editTextKommissioniert)).inAdapterView(withId(R.id.jflArticleList_ListView)).atPosition(0).check(matches(withText("60.0")));
但我总是得到这个例外:
android.support.test.espresso.AmbiguousViewMatcherException: 'with id:
at.stockserv:id/editTextKommissioniert' matches multiple views in the
hierarchy.
我该怎么做才能访问我的适配器中的第一行?
试试下面的方法,对我有用
onData(anything()).inAdapterView(withId(R.id.jflArticleList_ListView))
.atPosition(0).onChildView(withId(R.id.edt_id)).check(matches(withText("60.0")));
我正在使用 Espresso 来测试我的应用程序。我有一个列表视图,其中包含一些数据。我想检查第一行中编辑文本的值。
我试过了:
onData(withId(R.id.editTextKommissioniert)).inAdapterView(withId(R.id.jflArticleList_ListView)).atPosition(0).check(matches(withText("60.0")));
但我总是得到这个例外:
android.support.test.espresso.AmbiguousViewMatcherException: 'with id: at.stockserv:id/editTextKommissioniert' matches multiple views in the hierarchy.
我该怎么做才能访问我的适配器中的第一行?
试试下面的方法,对我有用
onData(anything()).inAdapterView(withId(R.id.jflArticleList_ListView)) .atPosition(0).onChildView(withId(R.id.edt_id)).check(matches(withText("60.0")));