I want to know if it's possible to programmatically access an element, say the current element I am hovering over, and perform the equivalent of right clicking it, going to "inspect element", selecting it in the Elements tab, right click "copy xpath" or "copy css path".
Additionally, I would like to know if it's possible to get xpath or css path of similar elements. Say all the links on the side of this website, how to make chrome get an xpath or css path expression that represents that group of links under Similar Questions?
My purpose is to write an extension that lets me easily grab xpath or css path of elements on page that is accurate enough for automating web applications for testing.