我有一个Android应用程序和Appium自动化的可滚动列表(搜索结果),我需要从中选择一个特定的元素。 Appium检查员正在提供诸如index,resource-id和xpath之类的信息。xPath for Android中的上市元素(使用appium自动化)
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检查员提供)是这样的:
//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]
为塞康D转换结果是..
//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] /机器人.widget.LinearLayout [1] /android.widget.TextView [1]
上面的xPaths工作,但我正在寻找更短的版本。我尝试了各种组合,但由于我是新手,所以无法找出解决方案。任何关于这个或任何可以完成这项工作的工具的帮助?
u能提供最后一个TextView.properties在appium inspector中显示的细节 – SaiPawan
@sai更新信息 – TestingWithArif
检查答案 – SaiPawan