Selenium xpath selector based on the element text

后端 未结 4 543
小鲜肉
小鲜肉 2020-12-01 11:13

What would a Selenium xpath selector be for the following HTML:

  • First
  • Second
  • Third<
4条回答
  •  悲哀的现实
    2020-12-01 11:37

    I think this is what you are looking for

    ul/li[contains(text(), "Second")]
    

    and better still

    ul/li[text() = 'Second']
    

提交回复
热议问题