This userscript is intented to retrieve the full CSS/Xpath path of a selected node or a provided text as argument.
x('text in the page')
By example, open ChromeDevTools, select a node in the 'elements' tab, then in console tab, type :
x($0)
(fisrt div after body of this page)
CSS
body.logged-in.env-production.intent-mouse > div.position-relative.js-header-wrapper
XPath
//body[@class='logged-in env-production intent-mouse']/div[@class='position-relative js-header-wrapper ']
// select a node in tools/elements
retrieveCssOrXpathSelectorFromTextOrNode($0, 'xpath')
//body[@class='logged-in env-production intent-mouse']/div[@class='position-relative js-header-wrapper ']