如何获取android元素';s';资源id';和';内容描述';appium java中的属性值?

如何获取android元素';s';资源id';和';内容描述';appium java中的属性值?,java,android,appium,android-uiautomator,Java,Android,Appium,Android Uiautomator,我想在运行时获取android元素的资源id和内容描述 我试过这个: myElement.getAttribute("resource-id") myElement.getAttribute("content-desc") 但获取错误为“此元素没有资源id属性”” 有什么方法可以得到这个吗?根据这个,获得“内容描述”的方法是使用 myElement.getAttribute(“名称”)。用于资源id使用:webElement.getAttribute(“resourceId”)用于获取内容描述

我想在运行时获取android元素的资源id和内容描述

我试过这个:

myElement.getAttribute("resource-id")
myElement.getAttribute("content-desc")
但获取错误为“
此元素没有资源id属性”

有什么方法可以得到这个吗?

根据这个,获得“内容描述”的方法是使用
myElement.getAttribute(“名称”)。

用于资源id使用:
webElement.getAttribute(“resourceId”)
用于获取内容描述:


myElement.getAttribute(“contentDescription”)

当我使用AndroidElement的AdnroidDriver-to-resource-id属性时,这一项对我有效