-1

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 class="title kpi-tile3-title o9-tooltip" data-o9title="Safety Stock">Safety Stock</div>
1

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

EDIT

Try this:

driver.find_element_by_css_selector("div:contains('Safety Stock')")

or this:

driver.find_element_by_css_selector("div[data-o9title='Safety Stock']")

2 Comments

contains is not working, Can you tell me how to do using inner text
Sorry, my mistake there, edited my answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.