SkillAgentSearch skills...

RetrieveCssOrXpathSelectorFromTextOrNode

Retrieve absolute CSS or Xpath selector from text string or HTML node

Install / Use

/learn @sputnick-dev/RetrieveCssOrXpathSelectorFromTextOrNode
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

This userscript is intented to retrieve the full CSS/Xpath path of a selected node or a provided text as argument in your browser Dev Tools.

Usage :

By text :

x('text in the page')

By DOM node :

By example, open ChromeDevTools, select a node in the 'elements' tab, then in console tab, type :

x($0)

Sample output :

(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 "]

Or using specific css or Xpath expression:

// select a node in tools/elements
retrieveCssOrXpathSelectorFromTextOrNode($0, 'xpath')
//body[@class="logged-in env-production intent-mouse"]/div[@class="position-relative js-header-wrapper "]

Forks, and PRs welcome!

View on GitHub
GitHub Stars16
CategoryDevelopment
Updated2mo ago
Forks2

Languages

JavaScript

Security Score

75/100

Audited on Feb 1, 2026

No findings