没有匹配任何元素

did not match any elements

ValueError: 元素定位器 'id=com.test.robot:id/et1' 不匹配任何元素。

即使应用源包含上述 id

令人困惑!

需要帮助!

我们可以使用多种技术定位元素。

其中之一 xpath 它在任何情况下都可以正常工作

众所周知,我们的 UI 是基于 xml 的。 xpath 用于在 xml 文档中为我们要访问的元素指定特定节点

这是基于xpath定位的示例

Click Element   xpath=/hierarchy[@rotation="0"]/android.widget.FrameLayout[@index="0"]/android.view.View[@index="0"]/android.widget.FrameLayout[2]/android.widget.LinearLayout[@index="0"]/android.widget.ListView[@index="0"]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[@index="1"]/android.widget.TextView[@index="0"]