In this lecture, we're going to talk about file upload software, performing a file upload.
Once again, the site, like whatever I have for the demo site, I don't really have a support for file
uploading did.
So I'm actually going to show you on different site, which actually has got the file upload functionality.
So you can see that there is a site called Yuppy which actually has way.
Do you can I mean, that just shows you how you can do an extra hour uploads and stuff.
So if you just choose a file, you can specify a file to choose and you can see that the file upload
just happens over here like Officer Geopark or something like that.
This is pretty, pretty straightforward way of doing it.
We can do exactly the same thing and see if that particular file upload is actually happening because
it opens the file Josa Ravindra window and then it also opens the file and uploads it.
So why can't we just try to do the exact same thing and see how it actually works.
So for doing that I'm going to create once again a new file and I'm going to call this as file upload
Dodgiest.
And over here I'm going to type the exact same code that we always try to do.
So I'm just going to probably just kind of copy the code until.
Over here, and I'm just going to pace this probably this time, I'm just going to use Firefox just
for a change and I'm going to call this as Firefox and Arrow method.
And over here, I'm just going to go to the particular page and I'm going to see how the particular
file upload is going to happen.
So for doing that, I'm just going to do something like this.
So this is going to be the exact same thing.
Go to this particular file.
So for doing that, I need to go to that particular page so the court is going to look something like
this, so it's going to be the same thing that I will examples like which are applaud.
I'm going to wait for the network will to be fully.
Completed, and once it is there, I need to perform a file upload operation on that particular page.
So if you go to that particular site, maybe I could just open the Chrome browser and I can just copy
the site.
Pasted over here.
That's right, click inspect element, you can see that the the button is actually off type file over
here, which means it's a file upload type or file type.
So in these situations, we actually need to, first of all, identify the control, which is nothing
but the file type.
And then we need to call what is called as a method called a set input files method.
If we call the particular method where we can specify the file names and stuff.
So I'm going to probably right that code over here and then I can show you what it really mean.
So if I just do enervate off the page dot, I wonder and if I bigger control so for doing that, I'm
just going to use a dollar symbol so you can see that we have never, ever discussed about this $ symbol
so far, because all this time we have been using just using the click operation or full operation or
either by using the select operation or Select Options operation.
So we just always try to identify a control repository file of a control directly to the operation that
we're going to perform.
But this time we're going to be identifying a control like a selector itself.
That's why I'm going to be using a dollar operation.
So you can see that within playwrite or even in the puppeteer, there is a concept called as selectors
using the DOM operation, like how you do select in the chrome tool itself so you can use the daughters,
our daughters or daughter, daughter, evol or evol or here.
So these two are pretty much exactly the same as this one.
So you can use those operation, which is pretty good.
I mean, you can do the exact same operation that you can actually do on the browser, something like
this.
So if I just do a dollar here, you can see that this is the same data which I'm talking about, guys,
so we can bring the particular dollar over here and then we can specify the input of probably the type.
I guess it's file.
If I'm not wrong, I can just specify that and oops over here and you can see that it just brings me
up the particular control over here.
So this is exactly the same identifier technology we can use, even within the playwright as well.
This is really, really cool.
I mean, whatever that we can do on the browsers, we can do on the playwright Aspell directly.
And you can see that with Donna, the intelligence is even more better.
It also bring up the intelligence of what type of control that you are about to select, like progress
or picture parum, output options, Aadi, rubies and stuff.
And the one which I'm going to be writing is input.
So if I just type it, you can see that the intelligence is actually going to show you and then you
can do whatever that you want to do so you can specify the file or something like that.
So it will do it for you over here.
And once you have this particular handle, like once you identified the control file, then you can
also do something like handle DOT.
You can select the file, which you are going to be sitting.
So you can just do a set input file method where you can specify the part of the file where the particular
office chargeback is sitting.
I think it is sitting in my downloads folder, so I'm just going to copy paste that location over here.
That's it.
So once I do that, it is going to do it for me.
So this is the two options that you didn't do during the first identify the control and then you do
perform a set operation and you can do the set input file directly over here.
But I just want to split it to two lines that it's more meaningful to see and more clear to understand.
Then once that is done, I can just go over here and then I'll choose the file, upload Argyris.
And if I hit the enter, I'm intentionally not closing the browser at the moment because I want you
to see what I'm doing.
You can see that it actually is doing the file for us so instantly.
Just quite cool, right?
I mean, you just did that for us.
So it just uploaded a file over here and everything is now like automated fashion.
So this is the way that you can actually upload a file in playwrite and you can play around with it.
Medio NextRadio with our Kasparov's a distinct feature.