Okay, so now on to creating our selector so we can select data from our table and just get the text
contents out.
So first you need to open up Chrome tools inside of Chrome browser.
So just press F12 to open up Chrome tools and you can see all of these tabs with different tools.
In this case, we need to press the select an element to inspect it, press that now it turns blue,
and then you can select elements on a website.
Let's select the first table data cell here.
I click on that and then I get shown the corresponding HTML in the page where this element is residing.
In this case, we need to right click on it since we want this data and we can right click and select
copy and then select copy selector.
Then it's going to the console tab and let's paste in and see what kind of selector we got.
So here we can see we have a body and then we select the child table of this body and a child element.
Body and a child element, table row, child element, table data cell and so on and so on.
And notice we also have the end child, which which means that we only select the second child of the
table rows.
And the first child here for the table, data row and table data cells.
Okay, so what does it actually print out?
How can we use this?
Let's try and see.
So to select these this element, we could also use pure JavaScript, but to make it easier for ourselves,
we're going to use jQuery, which is a JavaScript library.
Now some pages already have jQuery injected or enabled in them, so you can just type up dollar sign
and then have a quote and then paste in your selector and then end quotes and then end with a parenthesis
and then say dot text and then call it with the parenthesis.
But here you can see it says dollar sign, dot, dot, dot, dot Text is not a function, which means
that jQuery is not enabled on this side.
But there is a fix to that, which is that we can just inject jQuery into the page as we has it, as
we have it open inside of Chrome.
So I have a little plugin from the Chrome web store.
It's called jQuery Inject.
Sometimes you can also find code snippets that you can copy in the clipboard and paste inside console.
I like to use this extension because I can just click on the button up here to enable jQuery if the
page doesn't have jQuery.
So I click up here for the plugin that I downloaded here, this one and now it says something about.
Cookies, blah, blah, blah.
It doesn't matter.
It's just a warning.
But now we can try and type in the same command again.
And now we see the actual text content of the first data cell in the table.
So far, so good.
But of course, we need to scrape the data from all the table cells in an automatic way.
So, I mean, we can't just type in TD.
Child two Then we will get the contact name here and so on and so on.
That's not a very automated way to do it.
But yeah, I guess if you have an intern then he can do that.
But let's find a smarter way to do this and get all of the table data.