WEBVTT

00:00:00.001 --> 00:00:10.000
So the Selector Selector bookmarklet is kind of a tool that I use to help me make other bookmarklet tools.

00:00:10.000 --> 00:00:21.000
What it does is this, let's run it. You can select different parts of a page and as I click you can see that these sections are being outlined in red.

00:00:21.000 --> 00:00:30.000
These have been added to a collection that you will see shortly. You can also use the arrow keys to navigate.

00:00:30.000 --> 00:00:38.000
So let's hover over one of these and use the arrow key to go up the DOM until we have selected a larger section.

00:00:38.000 --> 00:00:44.000
So let's grab all of that. I'm going to select this using Enter.

00:00:44.000 --> 00:00:51.000
When I've collected everything I need to, I can either press that button up there which is 'I am done' or you can just press D.

00:00:51.000 --> 00:00:56.000
It's disappeared. I don't know what happened there. Anyway, it still works.

00:00:56.000 --> 00:01:01.000
Then what it does is it gives you the selections that you've made and this is a description list.

00:01:01.000 --> 00:01:09.000
You can just click on the selector here and it will automatically select. See, there's a lot of selects going on here.

00:01:09.000 --> 00:01:17.000
That's why I called it the selector selector and that makes it easy to copy and paste or you can copy all of them in one go.

00:01:17.000 --> 00:01:21.000
So if I do that and paste it into a text file, I'll have everything there.

00:01:21.000 --> 00:01:27.000
The other thing it allows you to do is to toggle between different types of selectors.

00:01:27.000 --> 00:01:30.000
So here we've got it writing out `document.querySelector` statements.

00:01:30.000 --> 00:01:37.000
As I said, it's a tool I created to make it easier for me to quickly grab the things I need on a page.

00:01:37.000 --> 00:01:50.000
So if I press the T key, you will see you will now switch between the `document.querySelector` statements to just a CSS selector or an XPath reference.

00:01:50.000 --> 00:01:58.000
Also something to note, if the item has an ID in it, it will favor that over its position in the DOM wherever possible.

00:01:58.000 --> 00:02:05.000
So whichever you are looking at here, you can also copy those to the clipboard.

