【发布时间】:2017-09-01 02:35:54
【问题描述】:
我在 Android 应用中有一个可滚动列表(搜索结果),对于 Appium 自动化,我需要从中选择一个特定元素。 Appium 检查器提供索引、资源 ID 和 xpath 等信息。
content-desc:
type: android.widget.TextView
text: AMI
index: 0
enabled: true
location: {60, 513}
size: {81, 61}
checkable: false
checked: false
focusable: false
clickable: false
long-clickable: false
package: com.abc.xyz.debug
password: false
resource-id: com.abc.xyz.debug:id/student_label_text
scrollable: false
selected: false
第一个结果的xPath(由appium inspector提供)是这样的:
//android.support.v7.widget.RecyclerView[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout [1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android .widget.TextView[1]
第二个结果是..
//android.support.v7.widget.RecyclerView[1]/android.widget.FrameLayout[2]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout [1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android .widget.TextView[1]
xPaths 以上工作,但我正在寻找更短的版本。我尝试了各种组合,但由于我是新手,所以无法找出解决方案。对此或任何可以完成这项工作的工具有任何帮助吗?
【问题讨论】:
-
你能提供最后一个TextView..properties在appium检查器中显示的详细信息
-
@sai 更新信息
-
查看答案
标签: android selenium xpath appium