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 Answers1

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

kadis
  • 181
  • 6