【问题标题】:how to get android element's 'resource id' and 'content description' attributes value in appium java?如何在appium java中获取android元素的“资源ID”和“内容描述”属性值?
【发布时间】:2015-01-14 04:12:41
【问题描述】:

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

我试过这个:

myElement.getAttribute("resource-id")
myElement.getAttribute("content-desc")

但出现“this element does not have the resource-id attribute”错误。

有没有办法得到这个?

【问题讨论】:

    标签: java android appium android-uiautomator


    【解决方案1】:

    根据这个post,获取“content-desc”的方法是使用 myElement.getAttribute("name").

    【讨论】:

      【解决方案2】:

      用于资源 ID:webElement.getAttribute("resourceId")

      【讨论】:

      • 在使用 AdnroidDriver 为 AndroidElement 的资源 ID 属性时,这个与我一起工作
      【解决方案3】:

      获取 content-desc 使用:

      myElement.getAttribute("contentDescription")

      【讨论】:

        猜你喜欢
        • 2018-06-04
        • 2021-01-16
        • 2014-05-05
        • 1970-01-01
        • 1970-01-01
        • 2020-12-24
        • 2021-11-14
        • 2020-11-25
        • 2017-10-23
        相关资源
        最近更新 更多