Select Element By Text in Selenium

后端 未结 4 926
眼角桃花
眼角桃花 2021-01-23 02:17

This may sound so simple but why there is no method to find element by its inner text without using xpath? for instance there is an element:

4条回答
  •  感动是毒
    2021-01-23 02:50

    Try to use methods in XPath.

    driver.findElement(By.xpath("//button[text()='Some Text']"));
    

    Hope this will work!

提交回复
热议问题