使用espresso工具测试自动完成的textview [英] Testing autocomplete textview using espresso tool
问题描述
我有一个自动完成的textview,并且正在对其设置Adapter视图以显示建议列表.在espresso上测试时,我想从建议列表中选择一个项目位置,但是它无法识别espresso上的自动完成文本视图适配器.
I have an autocomplete textview and I am setting an Adapter view on it to show the list of suggestions. While testing on espresso, I want to select an item position from list of suggestions but, it does not identify the auto complete text view adapter on espresso.
我从堆栈溢出尝试了以下答案: 使用具有动态功能的espresso android的DropDown值选择元素ID的
I tried this answer from Stack overflow: DropDown value selection using espresso android with dynamic element id's
但是,这对我不起作用.在这方面的任何帮助将是巨大的. 谢谢.
But, this did not work for me. Any help on this would be great. Thanks.
推荐答案
,或者您也可以尝试 onData .因为 onData 对我不起作用
or you can try instead onData. Because onData not working for me
onView(withText("Your field name"))
.inRoot(withDecorView(not(is(getActivity().getWindow().getDecorView()))))
.perform(click());
这篇关于使用espresso工具测试自动完成的textview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!