1
我有一个ExpandableListView
,我想click()
它的孩子之一。浓咖啡 - 为什么浓咖啡找到这个匹配模糊?
我试过LOADS OF不同的方式,但我似乎无法理解Espresso是如何工作的。
例如,为什么此代码不起作用?
onData(withId(R.id.execexpList)).onChildView(is(withId(200))).perform(click())
出于某种神圣的原因,则返回“暧昧比赛”我的ExpandableLIstView和我的其他的ListView,但他们有不同的ID。
任何人都可以帮我吗?
不应该'withId'采取'R.id'? –
@JaredBurrows我已经将我的'ExpandableListView'中的每一行设置为一个特定的ID。这就是为什么我硬编码它 – RafaelC
你在视图上使用了'setId'吗?首先尝试'withId(is(int))'。请参阅https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers.html#withId(int)。如果这不起作用,请尝试'setTag'。然后使用https://developer.android.com/reference/android/support/test/espresso/matcher/ViewMatchers.html#withTagKey(int)。 –