我如何 select 一个在文本 属性 中没有任何值并且在 Appium Automation 中具有相同类名和相同 ID 的元素?

How do i select an element which doesn't have any value in text property and has same className, same Id in Appium Automation?

我正在自动化电子商务应用程序,我需要 select 一类购物。问题是所有类别都具有相同的类名、ID 并且在文本 属性.

中没有值

我试过这样..

driver.findElementsById("//com.app.mobileapp:id/imgCategory").get(1).click();

我得到 Index out of bound 异常。

谢谢

苏雷什;

请尝试以下 Xpath。我对您在 get() 函数中使用的索引有疑问。

By.xpath("//android.widget.ImageView[@index='2']");