To install it, open this page in your browser, and then drag the following link to your bookmark bar: SelectorGadget.
To use it, open the page
Click on the element you want to select. Selectorgadget will make a first guess at what css selector you want. It’s likely to be bad since it only has one example to learn from, but it’s a start. Elements that match the selector will be highlighted in yellow.
Click on elements that shouldn’t be selected. They will turn red. Click on elements that should be selected. They will turn green.
Iterate until only the elements you want are selected. Selectorgadget isn’t perfect and sometimes won’t be able to find a useful css selector. Sometimes starting from a different element helps.
For example, imagine we want to find the actors listed on an IMDB movie page, e.g. The Lego Movie.
Navigate to the page and scroll to the actors list.
Click on the selectorgagdget link in the bookmarks. The selectorgadget console will appear at the bottom of the screen, and element currently under the mouse will be highlighed in orange.
Click on the element you want to select (the name of an actor). The element you selected will be highlighted in green. Selectorgadget guesses which css selector you want (
.itemprop in this case), and highlights all matches in yellow.
Scroll around the document to find elements that you don’t want to match and click on them. For example, we don’t to match the title of the movie, so we click on it and it turns red. The css selector updates to