Android 使用appium获取线性布局索引

Android 使用appium获取线性布局索引,android,selenium,xpath,appium,selendroid,Android,Selenium,Xpath,Appium,Selendroid,我正在进行直线布局。所以我想索引的线性布局,其中有内容描述为“产品列表” 所以我所做的是: List<WebElement> allIdsOnCurrentScreen = driver.findElements(By.xpath("//*[@class='android.widget.LinearLayout']")); for(int i=0;i<allIdsOnCurrentScreen.size();i++){ if(allIdsOnCurrentS

我正在进行直线布局。所以我想索引的线性布局,其中有内容描述为“产品列表”

所以我所做的是:

 List<WebElement> allIdsOnCurrentScreen = driver.findElements(By.xpath("//*[@class='android.widget.LinearLayout']"));
 for(int i=0;i<allIdsOnCurrentScreen.size();i++){
        if(allIdsOnCurrentScreen.get(i).getAttribute("name").toString()=="product_list")
            System.out.println(allIdsOnCurrentScreen.get(i).getAttribute("index"));
    }

怎么做?我想索引的线性布局,目前在屏幕上可见的内容描述'产品_名单'

请使用“content desc”并再次运行,而不是使用属性“name”。

appium无法读取“index”属性,这是一个框架限制。至少现在是这样

System.out.println(allIdsOnCurrentScreen.get(i).getAttribute("index"));