Home > Mobile >  How to write CSS Selector using Inner Text?
How to write CSS Selector using Inner Text?

Time:09-29

Can anyone help me with the css selector for the below element. Here there are multiple elements available with same class name. Please use inner text to form a css selector for this

<div  data-o9title="Safety Stock">Safety Stock</div>

CodePudding user response:

It is not possible.
Selenium CSS Selectors do not support locating elements based on their text content.
See this or this or other similar questions about that.

CodePudding user response:

Try this:

$("div:contains('Safety Stock')")

or this:

$$("div[data-o9title='Safety Stock']")
  • Related