Find an element by Xpath which contains text

后端 未结 2 1868
春和景丽
春和景丽 2020-12-31 21:55

This works fine if I search for a single string:

var element = Driver.FindElement(By.XPath(\"//a[contains(text(), \'About us\')]\"));

But c

2条回答
  •  长发绾君心
    2020-12-31 22:28

    say or between two calls of contains function

    //a[contains(text(), 'About us') or contains(text(), 'about us')]
    

    or use translate function to make xpath case insensitive

    //a[contains(translate(text(), 'ABOUTS', 'abouts'), 'about us')]
    

提交回复
热议问题