请教下,

WebElement Image = driver.findElementByXPath("//android.widget.ImageView[@index=0]");
System.out.println("get index Attribute"+ Image.getAttribute("index"));
System.out.println("get index Attribute"+ Image.getAttribute("clickable"));

Image.click();

为何 WebElement Image= driver.findElementByXPath("//android.widget.ImageView[@index=0]");
可以定位到元素,但是获取 Image.getAttribute("index") 这个属性就不支持呢,index 不是也是一种属性吗?

而 Image.getAttribute("clickable") 是能拿到是否可点击的数据。

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)
Command duration or timeout: 70 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html


↙↙↙阅读原文可查看相关链接,并与作者交流