当我想用以下代码获取界面所有的textview:
  
   for(int i=0;;i++){
if(solo.getText(i)!=null){
Log.i("print", "info" +i+ solo.getText(i).getText().toString());
}else{
Log.i("print", "over");
break;
}
   会报错误:
   
    junit.framework.AssertionFailedError: TextView with index 6 is not available!   我查robotium的api,看见getText方法:
   
   getText    public android.widget.TextView getText(int index)    Returns a text view with a certain index.    Parameters:
        index - the index of the text view. 0 if only one is available 
    Returns:
        the text view with the specific index or null if index is invalid    为什么会报错?有知道的好人不~

解决方案 »

  1.   

    取textview  可用solo.getCurrentTextViews(parent);
    gettext() 根据索引取内容的
    你上面的错误应该是 下标为6的索引不存在了吧
    看一下你的测试的activity 有几个textview 
      

  2.   

    取textview  可用solo.getCurrentTextViews(parent);
    gettext() 根据索引取内容的
    你上面的错误应该是 下标为6的索引不存在了吧
    看一下你的测试的activity 有几个textview