Looking for the best way to GET the xpath and css selector of a specific element using jQuery or Extjs. To basically select a random element and traverse up the dom and retreive it’s unique css selector or xpath. Is there a function that can do this already or does anyone have a custom function that can do this?
Share
Why not just check for an “id” value, and if there is one there just use it. If there isn’t one, generate a unique random “id” value, give it to the element, and then use that.
edit: here’s a proof-of-concept jQuery hack to build up a selector for any element you click on.