在下面的例子中,Appium能够按类定位元素,但是当我们想要基于每个元素的内容处理数据时,我们看到一个错误。为什么我们不能获得content-desc的属性? 任何意见赞赏。Appium无法获得“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);
Error: Found arrayOfProperties2 total: 32
org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
这可以帮助我猜测https://github.com/appium/appium/issues/5142。我相信代码更改被推入。 – nullpointer 2016-02-03 12:30:28