问题
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?
This is the image of layout seen from UI Automator.

回答1:
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));
}
}
来源:https://stackoverflow.com/questions/20358149/naf-nodes-automation-with-robotium