如何点击一个按钮,这是在10位置的ListView索引 - Robotium自动化? [英] How to click on a button, which is indexed at 10 position in ListView - Robotium automation?

查看:221
本文介绍了如何点击一个按钮,这是在10位置的ListView索引 - Robotium自动化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设,我有一个ListView,其中包含20 ListItems的。每个项目是有一个按钮,现在我想点击它位于ListView中10位置的按钮。如何我可以通过它robotium自动化?

Suppose, I have a ListView, which contains 20 ListItems. Each item is having a button, now I want to click a button which is located at 10 position in ListView. How I can automate it via robotium?

推荐答案

尝试做TI这样的(不知道是否可行)

Try to do ti like this (not sure if it works)

//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

希望这有助于!

Hope this helps !

这篇关于如何点击一个按钮,这是在10位置的ListView索引 - Robotium自动化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆