1
<Span class='abc' id='cell-123'>test123</span>

How can I retrieve the value of span based on value

Xpath = //span[text()='test123']
CSS = span:contains('test123')

Above CSS is not working is the syntax correct? Can anyone help with how to retrieve the element value by CSS selector

Pritam C.
  • 21
  • 5
  • Can you clarify more ? Do you want to retrieve `test123` from given `HTML` ? And what error are you getting ? – Akzy Mar 02 '23 at 11:15
  • I want to get the element based on text since that entry in span was created in the above step. Hence I want to find the element by tag span and text present test123 using css selector – Pritam C. Mar 02 '23 at 11:45
  • Does this answer your question? [Why doesn't the selector h3:nth-child(1):contains('a') work?](https://stackoverflow.com/questions/4781141/why-doesnt-the-selector-h3nth-child1containsa-work) – sound wave Mar 08 '23 at 14:14
  • `contains` is no longer available so you have to use xpath – sound wave Mar 08 '23 at 14:15

0 Answers0