【问题标题】:Xpath not containsXpath 不包含
【发布时间】:2017-09-23 13:26:45
【问题描述】:

有没有办法选择不包含ng-show的xpath 请在下面找到 xpath: 我熟悉 not(contains()),但它有 2 个参数。 我希望它不包含ng-showitself,因为我还有一些包含 ng-show 的元素,我不想选择其中任何一个。

<span ng-show="displayValue" class="ng-binding">0 km</span>

提前致谢

【问题讨论】:

    标签: xpath contains


    【解决方案1】:

    在下面试试这个xpath

    //span[not(@ng-show)][not(@class='percent ng-binding')][@class='ng-binding']
    

    xpath的解释:-只有&lt;span&gt;标签才会返回,哪些属性不包含ng-show

    【讨论】:

    • 嗨,Janish,是的,我试过了,它不起作用。我不得不将它添加到我之前的 xpath 中,所以我得到了这个声明,它不起作用//*[contains(@class,"ng-binding") and not(contains(@class,"percent ng-binding")) and span[not(@ng-show)]]
    • 但是我还有其他条件必须写在同一个语句下:)
    • 非常感谢
    • 它对我有用,没有显示任何错误。确保在到达此元素之前提供一些等待。这样您的驱动程序就可以找到该网络元素。
    猜你喜欢
    • 2020-09-28
    • 2016-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-28
    • 2014-07-23
    • 2015-09-20
    相关资源
    最近更新 更多