【问题标题】:Get element by using whats inside that element [duplicate]通过使用该元素内部的内容来获取元素[重复]
【发布时间】:2019-11-23 10:19:58
【问题描述】:

我想使用 selenium Web 驱动程序使用按钮元素的内部文本访问元素。

我想使用“下一个”值来捕捉这个按钮元素。

<button>next</button>

我该怎么做?

【问题讨论】:

    标签: selenium selenium-webdriver


    【解决方案1】:

    您可以使用以下xpath 选项来获取带有文本next 的元素

    选项1

    //button[text()='next']
    

    选项2

    //button[contains(.,'next')]
    

    选项3

    //button[contains(text(),'next')]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-12
      • 1970-01-01
      • 2011-02-14
      • 2011-12-10
      • 2017-08-03
      • 2020-03-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多