Need to identify xpath for android element using appium

前端 未结 4 2606
没有蜡笔的小新
没有蜡笔的小新 2021-02-20 16:49

I am testing my Android application using Appium framework. I have an android screen that doesn\'t have ids for its views (and I don\'t want to add...), so I thought using Xpath

4条回答
  •  天涯浪人
    2021-02-20 17:34

    Keeping in mind the fact that //foo[1] returns all foo nodes which are the first children of a their parent (not the first child of the foo node) try something like this:

    //ScrollView/LinearLayout/LinearLayout[2]/LinearLayout/RelativeLayout

    Not tested, but it should give you all the RelativeLayouts which are a child of a LinearLayout which is a child of a LinearLayout which is the second child of a LinearLayout which is the child of a ScrollView.

提交回复
热议问题