在Appium中运行时以编程方式标识移动元素(Android/iOS)的类(控件名)?

在Appium中运行时以编程方式标识移动元素(Android/iOS)的类(控件名)?,appium,android-testing,android-uiautomator,Appium,Android Testing,Android Uiautomator,我正在使用Appium移动驱动程序。我想识别移动元素的特定于平台的类名(控件)(对于Android-文本视图、编辑文本、单选按钮等) MobileElement.getClass()只返回通用类名io.appium.java\u client.android.AndroidElement 虽然Android的UIAutomatorViewer公开了“class”属性,但事实并非如此 使用Appium使用MobileElement.getAttribute(“类”)以编程方式访问。我怀疑Appiu

我正在使用Appium移动驱动程序。我想识别移动元素的特定于平台的类名(控件)(对于Android-文本视图、编辑文本、单选按钮等)

MobileElement.getClass()
只返回通用类名
io.appium.java\u client.android.AndroidElement

虽然Android的UIAutomatorViewer公开了“
class”
属性,但事实并非如此 使用Appium使用
MobileElement.getAttribute(“类”)
以编程方式访问。我怀疑Appium正在隐藏该属性(我还没有尝试直接使用UiAutomator)

有人有线索吗


还有任何其他方法,我们可以使用Appium以编程方式找到类名,或者我需要使用UiAutomator吗?

如果您签出inspector,“class”属性实际上称为“type”。因此,请尝试
MobileElement.getAttribute(“type”)
@econoMichael。你说的是哪位督察?Android自己的UIAutomatorViewer和Appium的inspector都显示了“class”(而不是“type”)属性,这在Appium中是无法通过编程访问的。getAttribute(“类”)和getAttribute(“类型”)都抛出“NoTouchElementException”hm它是一个混合应用程序吗?听起来像是在使用webview。使用appium inspector,我的本机应用程序上的元素都有属性“type”,但没有属性“class”。不,它不是混合应用程序。它完全是本地应用程序。我根本不使用webview。奇怪的是,如何使用appium inspector查看属性类型如果您签出了inspector,“class”属性实际上被称为“type”。因此,请尝试
MobileElement.getAttribute(“type”)
@econoMichael。你说的是哪位督察?Android自己的UIAutomatorViewer和Appium的inspector都显示了“class”(而不是“type”)属性,这在Appium中是无法通过编程访问的。getAttribute(“类”)和getAttribute(“类型”)都抛出“NoTouchElementException”hm它是一个混合应用程序吗?听起来像是在使用webview。使用appium inspector,我的本机应用程序上的元素都有属性“type”,但没有属性“class”。不,它不是混合应用程序。它完全是本地应用程序。我根本不使用webview。奇怪的是,如何使用appium检查器查看属性类型