如何单击 ListView 中索引为 10 的位置的按钮 - Robotium 自动化?

2024-04-18

假设,我有一个 ListView,其中包含 20 个 ListItem。每个项目都有一个按钮,现在我想单击位于ListView中第10个位置的按钮。我如何通过robotium实现自动化?


尝试这样做(不确定是否有效)

//get the list view
ListView myList = (ListView)solo.getView(R.id.list);
//get the list element at the position you want
View listElement = myList.getChildAt(10);// myList is local var
//click on imageView inside that list element
solo.clickOnView(solo.getView(listElement.findViewById(R.id.my_button)));// not double eE

希望这可以帮助 !

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何单击 ListView 中索引为 10 的位置的按钮 - Robotium 自动化? 的相关文章

随机推荐