user1786107 user1786107 - 1 month ago 6x
HTML Question

HTML XPath Searching by class and text

I want to find all elements in xpath by class and text. I have tried this but it does not work.

//[contains(@class, 'myclass')]//[text() = 'qwerty']

I am trying to find all elements that have a class of 'myclass' and the text is 'qwert' (these will be span elements)

//span[contains(@class, 'myclass') and text() = 'qwerty']


//span[contains(@class, 'myclass') and normalize-space(text()) = 'qwerty']