Question

i need to select a tag that contains an innertext i specify. can anyone help me with the xpath query ie <a href="#">wake up</a>. So if i pass wake to the xpath, it should select this a link

thanks

Accepted Answer

The XPath is simply //a[starts-with(., 'wake')].


Popular Answer

One way (it matches case sensitive):

//a[contains(text(), 'wake')]


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why