我有ListView与图片和文字.当我尝试点击项目时,我收到错误
android.support.test.espresso.AmbiguousViewMatcherException: 'with id: com.cifrasoft.telefm:id/cardsGridView' matches multiple views in the hierarchy. Problem views are marked with '****MATCHES****' below.
我使用以下代码:
onData(hasToString(startsWith("Item Text"))) .inAdapterView(withId(R.id.cardsGridView)) .perform(click());
我可以使用适配器的位置单击ListView,没有匹配或startWith?
解决方法
尝试使用atPosition().例如
onData(hasToString(startsWith("Item Text"))) .inAdapterView(withId(R.id.cardsGridView)).atPosition(0) .perform(click());
如果索引为0,则会单击找到的第一个匹配视图.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。