Alpha
Alpha

Reputation: 14046

How to write css for element containing specific text?

I've an element with text List which I want to use. I can write xpath like -

//li[text()='List']

but instead of using xpath, I want to use css. How should I write css for it? I tried with following by referring https://saucelabs.com/resources/selenium/css-selectors but didn't work.

li:contains('List')

Upvotes: 1

Views: 141

Answers (1)

singe3
singe3

Reputation: 2105

The CSS feature :contains('some text') is deprecated, you should only use xpath in your case. There is no way to do that using CSS

Upvotes: 1

Related Questions