在以下情况下,Appium能够正确地按类定位元素,但是当我们要基于每个元素的content-desc操纵数据时,会看到错误。为什么我们不能获得content-desc的属性?任何建议表示赞赏。
List<WebElement> arrayOfProperties2 = driver.findElementsByClassName("android.view.View");
List<WebElement> propertyMarkerEle = new ArrayList<>();
System.out.println("Found arrayOfProperties2 total: "+ arrayOfProperties2.size());
for (WebElement property : arrayOfProperties2){
String contentDesc = property.getAttribute("content-desc");
if (contentDesc.contains("property"))
propertyMarkerEle.add(property);
错误:发现arrayOfProperties2总计:32
org.openqa.selenium.NoSuchElementException:使用给定的搜索参数无法在页面上找到元素。(警告:服务器未提供任何堆栈跟踪信息)
使用名称”
property.getAttribute("name");
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句