0

I want to get the xpath & css_selector of an element. Is there a property of the element that I can use?

Please note, I am not trying to find the an element by xpath or css selector. I already have the element, I want to know what its xpath / css_selector is.

Many thanks

I have read the documentation here: https://selenium-python.readthedocs.io/locating-elements.html... and could not find the answer.

1

1 Answer 1

0

it's not possible. you may write your own function to implement that, but there's no built-in methods. check approaches here Find an element by text and get xpath - selenium webdriver junit

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

Comments

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.