本文介绍了NAF节点,自动化与Robotium的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在访问使用Robotium我的UI一些部件有问题。我发现有一些节点(NAF节点)是不是使用自动工具,Robotium入店。
I'm having a problem in accessing some components on my UI using Robotium. I discovered there are some nodes (NAF nodes) that are not accesible from automated tool as Robotium.
有没有访问它们的方法吗?使用特定的坐标我不会用点击。
Is there a way to access them? I would not use click using specific coordinates.
你可以建议我最好的做法是这样的问题?
Could you suggest me the best practices for problems like this?
这是布局从UI的Automator看到的图像。
This is the image of layout seen from UI Automator.
推荐答案
如果您想访问特定列表中的元素查看以下code可以帮助你做到这一点:
If you want to access the elements of a particular list view the following code should help you achieve that:
ListView lv = (ListView) solo.getView(id); //id is R.id.(list view id).
if (lv.getChildCount() > 0) {
for (int i = 0; i < lv.getAdapter().getCount(); i++) {
// Code to access each row of the list view. In my case each row is a linear layout and has a text view.
LinearLayout linearLayout = (LinearLayout) Utils.getViewAtIndex(lv, i,
getInstrumentation());
TextView accountName = (TextView) linearLayout.findViewById(R.id.(TextView id));
}
}
这篇关于NAF节点,自动化与Robotium的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!