1
00:00:01,190 --> 00:00:07,430
All right, so now we're going to start writing some of the code in the playwright for darknet language

2
00:00:07,430 --> 00:00:09,090
binding and we'll see how it actually works.

3
00:00:09,110 --> 00:00:12,440
So for doing that, I'm going to be some of the calls over here.

4
00:00:12,590 --> 00:00:18,110
And you can see that the installation is done by I mean, the playwright station can be done using the

5
00:00:18,110 --> 00:00:24,590
Newgate package, but the playwright itself is going to be installed within your project in three different

6
00:00:24,590 --> 00:00:24,860
ways.

7
00:00:24,890 --> 00:00:30,100
I mean, there are three or four different ways that you can actually do so playwright in this project.

8
00:00:30,150 --> 00:00:35,430
So if you use a playwright in test projects, all require browsers will be installed at the time.

9
00:00:35,660 --> 00:00:41,990
So this is one way that you can do or you can also use the playwright in Docker Container Image and

10
00:00:41,990 --> 00:00:43,400
then you can run it from there.

11
00:00:43,550 --> 00:00:48,540
This is another way and that is third way, which is going to be playwrite in the remote servers.

12
00:00:48,560 --> 00:00:55,130
So basically you can connect to a playwright using the remote instance using this particular playwright,

13
00:00:55,140 --> 00:00:56,380
Seelie, of Install.

14
00:00:56,390 --> 00:00:58,280
And then from there you can run that.

15
00:00:58,580 --> 00:01:05,600
I mean, I probably think that the best way is to go with this one, that playwrite of installed, I

16
00:01:05,600 --> 00:01:11,990
think, because it will do all sorts of things for you to put all the required browsers and playwrite

17
00:01:11,990 --> 00:01:17,000
required detailed files for you automatically and then you can start working from there.

18
00:01:17,030 --> 00:01:22,160
I think this option is something I really prefer to show for this demo and for the rest of the demo

19
00:01:22,160 --> 00:01:22,840
in the section.

20
00:01:23,000 --> 00:01:26,140
But as I said, I'm going to open my visual studio over here.

21
00:01:26,150 --> 00:01:31,700
I'm going to create a new project and I'm going to choose an Indian test and I'm going to choose the

22
00:01:31,700 --> 00:01:32,420
console.

23
00:01:33,020 --> 00:01:34,210
Sorry, not the console.

24
00:01:34,550 --> 00:01:36,730
The Indian test project.

25
00:01:36,740 --> 00:01:37,030
Yeah.

26
00:01:37,250 --> 00:01:46,850
And then I'm going to hit next and I'm going to choose the name of the project as playwrite sharp demo

27
00:01:47,450 --> 00:01:49,350
and create.

28
00:01:49,430 --> 00:01:55,670
So this is basically a document called Project, which is using the court, threw out one at the moment.

29
00:01:56,060 --> 00:02:03,050
And if you could see the package, you can see that in that one 2.0 and the framework is the dominant

30
00:02:03,050 --> 00:02:06,200
core and all those things are going to be pretty much exactly the same thing.

31
00:02:06,980 --> 00:02:13,400
And all I'm going to do to start working with the playwright itself is by adding a new get package.

32
00:02:13,730 --> 00:02:20,180
And if I go to the browser and if I search for playwrite, you can see that the playwright Sharp comes

33
00:02:20,180 --> 00:02:20,410
in.

34
00:02:20,960 --> 00:02:25,610
I think the still it is not changed to the name of the Microsoft team.

35
00:02:25,610 --> 00:02:30,530
There's still the author name is still the original author name, and they have not changed this one

36
00:02:30,530 --> 00:02:31,160
at the moment.

37
00:02:31,460 --> 00:02:35,420
So I'm just going to do an installation of the latest stable version.

38
00:02:36,050 --> 00:02:40,070
And you can see that there are a lot of details coming in.

39
00:02:40,520 --> 00:02:42,130
So I'm just going to install them on.

40
00:02:42,410 --> 00:02:43,070
There you go.

41
00:02:43,070 --> 00:02:44,150
It's done.

42
00:02:45,020 --> 00:02:51,290
And if I go back to the solution exploders, you can see that the workshop has been installed, which

43
00:02:51,290 --> 00:02:51,860
is quite good.

44
00:02:52,400 --> 00:02:58,730
And now once the installation is done, we can start writing the code and we can see how it actually

45
00:02:58,730 --> 00:02:59,000
works.

46
00:02:59,030 --> 00:03:04,880
So for doing that, I'm just going to go over here and probably I'm just going to copy paste this code

47
00:03:04,880 --> 00:03:09,290
and I will explain to you what these things are in our next video.

48
00:03:09,290 --> 00:03:12,200
But as of now, I'm just going to copy paste this code.

49
00:03:13,040 --> 00:03:17,540
You can see that it's going to ask you for adding the dependencies.

50
00:03:17,550 --> 00:03:18,650
Something's going to add that.

51
00:03:19,130 --> 00:03:25,370
And you can see that it actually tells you that the Awada operator can only be used within and I think

52
00:03:25,370 --> 00:03:25,820
method.

53
00:03:26,180 --> 00:03:32,210
So basically this particular test method is not and I think this has to be and I think method so that

54
00:03:32,210 --> 00:03:34,100
we can use an agreed keyword in C Sharp.

55
00:03:34,400 --> 00:03:37,640
So we need to change this method to async.

56
00:03:38,390 --> 00:03:39,830
So make sure that you do that.

57
00:03:39,830 --> 00:03:42,920
If not, you're going to get this kind of error all the time.

58
00:03:42,920 --> 00:03:44,390
So please try to do that.

59
00:03:44,750 --> 00:03:46,880
And once this is done, you're pretty good to go.

60
00:03:47,210 --> 00:03:51,440
And there is an error coming in for the click operation.

61
00:03:51,440 --> 00:03:53,990
I think it should be afraid as well.

62
00:03:55,180 --> 00:03:56,690
I'm not sure why.

63
00:03:56,720 --> 00:04:01,970
Yeah, I, uh, think this example has missed up with there should be a wait.

64
00:04:01,970 --> 00:04:08,390
If not, the code isn't going to work and I'm going to stay with this and try to run this test and see

65
00:04:08,390 --> 00:04:09,080
what's going to happen.

66
00:04:09,620 --> 00:04:13,670
So if I just write, click and run the test.

67
00:04:14,540 --> 00:04:22,270
So what will happen is once I run the test for the first time, it is actually going to download the

68
00:04:23,240 --> 00:04:28,360
the playwright for you so you can see that it is still downloading things over here.

69
00:04:28,640 --> 00:04:29,390
All right.

70
00:04:29,390 --> 00:04:36,470
You can see that it took some time to actually download all of the play regular stuff.

71
00:04:36,680 --> 00:04:42,950
And this test actually shows you a message saying, I think testamentary must have a non-white return

72
00:04:42,950 --> 00:04:43,250
type.

73
00:04:43,520 --> 00:04:48,590
So basically what we did is we just change this rate and I mean that method as a think method.

74
00:04:48,860 --> 00:04:53,160
But basically and I think method is going to be like a task type.

75
00:04:53,180 --> 00:04:55,750
It certainly have a wide return type over here.

76
00:04:55,760 --> 00:04:59,240
So basically it should be of a task return type.

77
00:04:59,240 --> 00:05:00,710
If not, they're going to get this at.

78
00:05:00,830 --> 00:05:06,200
So this is basically from the asynchronous programming model that you need to always follow to make

79
00:05:06,200 --> 00:05:10,760
sure that you change this guy to task, if not, the test is going to fail.

80
00:05:11,120 --> 00:05:17,000
So let me try to run this again and you will see that the test this time is going to work as expected.

81
00:05:17,000 --> 00:05:22,910
And you can see that it's actually opening on a Web browser and it is performing the operation and the

82
00:05:22,910 --> 00:05:23,930
disk has got passed.

83
00:05:24,080 --> 00:05:31,540
So you can see that just to run this particular test, like playwrite SERAP test in a think format,

84
00:05:31,550 --> 00:05:37,010
you need to change the signature of the method type return type, as I think, and task and other things

85
00:05:37,010 --> 00:05:40,370
are going to be pretty much exactly the same, like how we used to do that.

86
00:05:40,570 --> 00:05:43,250
We'll talk about how the code has to be written in our next video.

87
00:05:43,250 --> 00:05:47,380
But you don't set up and writing a writing and writing a simple test.

88
00:05:47,600 --> 00:05:50,890
This is quite similar to other language bindings as well.
