Espresso AutoCompleteTextView请点击 [英] Espresso AutoCompleteTextView click
问题描述
因此,我最近开始在我现有的Android项目之一中搞混Espresso.
So I recently started messing around with Espresso in one of my existing Android projects.
一切都很顺利,直到我开始在程序中找到AutoCompleteTextView
为止.我似乎不明白如何正确单击自动完成列表中的第一件事.实际上,我什至不知道在这种情况下使用哪个onView()
或onData()
.
Everything went pretty decently, until I came to find AutoCompleteTextView
in my program. I don't seem to understand how to properly click the first thing in the autocomplete list. I'm actually not even sure which to use, onView()
or onData()
in this instance.
推荐答案
因此,由于之前的问题,我终于明白了: 使用espresso工具测试自动完成的textview
So i finally figured it out, thanks to this previous question: Testing autocomplete textview using espresso tool
我只是将其版本发布给将来可能会使用它的人.
Ill just post my version of it for people who might use it in future.
onData(instanceOf("Whatever your arrayadapter contains".class)).inRoot(RootMatchers.withDecorView(not(is(mActivityRule.getActivity().getWindow().getDecorView())))).perform(ViewActions.click());
这篇关于Espresso AutoCompleteTextView请点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!