Thursday, March 5th, 2009
SelectorGadget: Selector Bookmarklet
>Having trouble working out a selector to grab that DOM element? Take heart, Blake Edwards and Kit Sunde pointed us to something that may help you out: SelectorGadget.
SelectorGadget is an open source bookmarklet that makes CSS selector generation and discovery on complicated sites a breeze.

With SelectorGadget, you just click on the DOM element(s), and presto, you get a selector. Try it out! Nice work from Andrew Cantino and Kyle Maxwell.
Related Content:











Does anybody know such a thing that creates XPath expressions instead of CSS selectors? That seems much more reliably to me.
um… Blake Edwards gave us Inspector Clouseau, not Inspector Gadget.
“um… Blake Edwards gave us Inspector Clouseau, not Inspector Gadget.”
For comedy, I give you a “10.”
I agree with yunosh. The functionality of this bookmarklet can be expanded to include xpath expressions.
Thanks for the feedback, guys. I’ll look into adding XPath. Let me know if you find sites it doesn’t work well on, there are tons of edge cases.
-Andrew
This seems like a great way to get selectors for jQuery. I’m curious about you xpath guys–why xpath rather than css?
XPath is useful for, among other things, greasemonkey scripts and microsummaries.
I’ve added XPath generation to the development version of SelectorGadget: http://selectorgadget.com
Awesome, nice work!