You can easily copy an element's XPath expression from DevTools. This is useful if you need this expression for an automated test for example.
- Go to the Elements (or Inspector) panel
- Use the context-menu (right-click) on the element you care about
- Go into the Copy sub-menu
- Choose the Xpath option
Note that you can then use this xpath expression to find elements again in DevTools.