Google Chrome: Is it possible to copy XPath dynamically (in code)?

Viewed 53

In google chrome, you can get the xpath of an element via if you right click on an element -> copy xpath:

Here is how GIF

QUESTION: Is it possible to dynamically access an xpath generated by Chrome using some Chrome Api (?) / Functions. I want to be able to copy the xpath in code?

Any ideas please?

Or if you know a better way to locate a dom element (i.e. a reference that can be persisted so I can locate it 'later' e.g. on another server)?

0 Answers
Related