【问题标题】:Not able to Identify element using following-sibling and preceding-sibling无法使用follow-sibling 和previous-sibling 识别元素
【发布时间】:2018-02-02 11:11:15
【问题描述】:

我想识别第三个元素 TextView:Completed 线性布局

使用第 5 个线性布局中的元素 TextView:Ashraf Mulla

我在 xpaths 下尝试过,但它无法识别 COMPLETED 元素。

Xpath 1 : "//android.widget.TextView[@text='Ashraf Mulla']/../preceding-sibling::android.widget.LinearLayout/android.widget.TextView[@text='COMPLETED']"

Xpath 2: "//android.widget.TextView[@text='COMPLETED']/../following-sibling::android.widget.LinearLayout/android.widget.TextView[@text='Ashraf 穆拉']"

UIAUTOMATORVIEWER_img

请帮忙。

【问题讨论】:

  • 提供xml文件的例子

标签: selenium xpath appium android-uiautomator


【解决方案1】:

Xpath 下面应该适合你

"TextView[@text='Ashraf Mulla']/ancestor::android.widget.LinearLayout/android.widget.TextView[@text='COMPLETED']"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-02
    • 1970-01-01
    • 2022-11-19
    • 2023-04-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多