All right, so now that we know how we can intercept the network records and stuff, but now in this
lecture, are we going to see how we cannot actually intercept on a real website like how we are doing
it at the moment over here?
I mean, unless until the real website, you said some provision of white listings of the site, which
you can make sure that you can intercept, you can do it.
But if you don't really do that, then there is going to be some sort of errors, which I will show
you what I really mean.
So if I go to this particular website, let's say the automation website over here, you can see that
we get a lot of details or here we can actually try to set these kinds of data like the learning part
category on our own custom data, like instead of the UI ABCDE, we can change this to a user interface
application programming interface testing, continuous integration and continuous delivery.
Just try to jeopardize this particular UI so that it looks so crazy and not so probably not to do that.
I'm actually going to go and open this XIKAR Jasen response.
This is a new plugin that I installed just to show you what I really mean over here.
So if I go to this JS on the homepage, the data, I can actually get the JS on file pretty easily from
here.
So if I just go all the way down, you can see that the learning part comes in and the one which I'm
looking for is going to be these data, the learning part categories and stuff.
So I can just copy this and I can create our own data like how we did for our this particular mock response
object.
So what I'm going to do is I'm just going to do the exact same thing this time and I'm going to go create
a, uh, file.
I'm call this network Inter Stepped a dart JS and this guy is going to do these things at the moment.
But instead of the market response object of this one, I'm actually going to paste these data that
I copied from the Jasen that I showed you.
So this is the home path data, which is the header data and then the learning part category over here.
And these are the data that I have modified for the title, have changed this from UI to user interface
on API to API testing and CIC to do C.A.T. testing like that.
So this way it looks a bit more different then compared to the original request, as you can see or
hear.
So I've completely modified that and I'm going to be doing the exact same thing like instead of the
DB over here, you know that this particular thing is actually coming from APIs data bundle homepage.
So this is where the data part is actually for us.
So I need to use this part instead of this DB path.
So I'm just going to copy paste this part over here.
I'm going to stay with this.
And these data remains the same application, Jason Mark response objects and stuff.
And the site is steeps and it is going to be executed.
Automation dot com.
I'm going to save this and I'm just going to run that.
So node network intercept error.
Dargis And if I hit the enter, let's see what's going to happen.
So this site is now going to show us an error message like that.
So it says network error.
So basically what's happening is the site is not loading for some reason and for some reason it's been
already.
We actually jeopardize that.
If I go to the console, you can see that this is going to be an error message here.
It tells you that access to the XML should be recognized at this API automation.
Dotcom's APIs that straight up into the search homepage from Origin Exude Automation has been blocked
by courts policy.
No access control allowed origin header is present on the requested resource and failed to load the
resource, blah.
And now none of that resource is going to load on the site and you can see that the site is kind of
loading.
So something has gone wrong.
This is what I was talking about, guys.
The course is another way.
It's a way to protect your site from the same origin policy.
And this cause origin resource sharing is one of the most important thing that you need to be understanding,
of course, is a mechanism that allows to resource on a Web page to be reconciled from another domain
outside of the domain from which the first resource was served.
A page may freely embed cross origin image, stylesheet script iframe and videos, but certain cross
domain requests, notably Ajax requests, are forbidden by default by the same origin policy.
This is super important.
I mean, this is exactly the same thing applicable for many automation, destroying tool like selenium
and even Cyprus.
If you're trying to open a different website which is embedded within the same.
It's going to show you some error because it's not following the court's policy like that, but yes,
this is what it is.
So cross origin resource sharing is the reason of being restricted from allowing you to inject some
data on the original website.
So this is going to be a security measure which is being done, which is really good.
So, yeah, that is the reason we can't actually do it on the real website, guys, the network interception
can only be done on a testing site like the fake I.D. over in our case, but not on the real website,
but in the testing application and within your office or within your testing environment.
You can do that by asking a developer to whitelist it so that you can still work with it.
It is not going to accept that court, US policy and stuff.
But yes, you can do it for the protection application.