1
我有LinearLayouts。所以我想索引那些内容为“产品列表”的线性布局。使用appium获取线性布局索引
所以我所做的就是:
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"));
}
,但我没能获得指数是这样的:
System.out.println(allIdsOnCurrentScreen.get(i).getAttribute("index"));
怎么办呢?我想要在content-desc'product_list'的屏幕上显示线性布局的索引。