1
00:00:00,300 --> 00:00:07,560
All right, so let's break down this code once again, like we did for the Java language binding and

2
00:00:07,560 --> 00:00:13,170
how we understood in the Java script and in the typescript language binding, you can see that in the

3
00:00:13,170 --> 00:00:15,330
playwright, the create async method.

4
00:00:15,330 --> 00:00:21,420
It's going to be pretty much like playwrite create a method that we used in our Java language binding.

5
00:00:21,450 --> 00:00:24,120
That's exactly what it is in the C sharp as well.

6
00:00:24,270 --> 00:00:27,620
So that's what this particular line of code is going to do for you.

7
00:00:27,900 --> 00:00:32,420
And then we need to launch the playwright's browser like this.

8
00:00:32,430 --> 00:00:37,470
I mean, once again, if you hit the dart or here, you can see that it brings you up the different

9
00:00:37,680 --> 00:00:42,990
properties like chromium, Devizes, Firefox and Selector Web.

10
00:00:43,260 --> 00:00:49,290
So this is the same property that was there, even for the Java and farther JavaScript and descript

11
00:00:49,290 --> 00:00:51,990
language binding, which is pretty much exactly the same thing.

12
00:00:52,200 --> 00:00:53,430
So no change on that.

13
00:00:53,760 --> 00:01:01,080
And the launch here, I mean, you can see that for every method there is this suffix of async because

14
00:01:01,080 --> 00:01:02,880
this is an asynchronous method.

15
00:01:02,880 --> 00:01:04,880
So always the author tried to put a..

16
00:01:05,050 --> 00:01:08,310
And this is the only thing which was not there in the Java.

17
00:01:08,310 --> 00:01:10,320
Like, you don't really have to write and wait.

18
00:01:10,920 --> 00:01:15,570
And I think that was something which I really like on the Java language binding.

19
00:01:15,570 --> 00:01:22,200
But here in C Sharp, it looks a bit weird to write this in asynchronous mode, but because this is

20
00:01:22,200 --> 00:01:25,400
a synchronous code, you can run this in parallel pretty easily.

21
00:01:25,410 --> 00:01:27,780
I mean, that is the other major benefit of it.

22
00:01:28,080 --> 00:01:34,290
But other than that, the only nagging thing is like you could write this code as if like a JavaScript

23
00:01:34,290 --> 00:01:39,420
based code, even in the C sharp language, which is the only thing with this which looks like different

24
00:01:39,420 --> 00:01:43,440
for that Java language binding versus C sharp language binding.

25
00:01:43,890 --> 00:01:46,380
But other than that, they are pretty much exactly the same thing.

26
00:01:46,390 --> 00:01:51,900
I mean, you launched the browser using the launch method and then there's this browser context.

27
00:01:51,900 --> 00:01:59,490
As you can see here, we're going to get the play radar devices, the device over here.

28
00:02:00,000 --> 00:02:02,910
And there is a method to browser context options.

29
00:02:02,910 --> 00:02:10,320
So you are converting it to a context option, using this to context, option, method.

30
00:02:11,280 --> 00:02:14,370
So this way it's going to be a context, basically.

31
00:02:14,640 --> 00:02:21,690
And then you can set the local geo location, permissions and things of that nature and you can do all

32
00:02:21,690 --> 00:02:24,660
sorts of things over here as well, which is quite good.

33
00:02:24,960 --> 00:02:31,740
And this false method actually tells that you are going to launch this in a headless mode or helpful

34
00:02:31,740 --> 00:02:32,610
more or something like that.

35
00:02:32,730 --> 00:02:38,340
So you can see that if it is false, then basically it is going to be an headful mode.

36
00:02:38,460 --> 00:02:42,060
And if you don't set anything, it's going to be an hitless model, something like that.

37
00:02:42,420 --> 00:02:47,460
Other than that, that there is no change at the moment on this particular line of code and the rest

38
00:02:47,460 --> 00:02:50,150
of code is going to be, again, straightforward and understandable.

39
00:02:50,190 --> 00:02:52,680
You're going to set the new context, I think.

40
00:02:53,160 --> 00:02:57,660
So basically, you are setting what context you're going to be using, like the browser context.

41
00:02:57,660 --> 00:03:02,790
You're setting the new context option where you need to parse the context options and then you're going

42
00:03:02,790 --> 00:03:09,480
to be open a new page and then you're going to be navigating like go to the page, click, I think,

43
00:03:09,600 --> 00:03:12,390
and take a screenshot.

44
00:03:12,840 --> 00:03:19,680
And if you hit Dart, let's say there is a film, you can see that there is a film set input file or

45
00:03:20,040 --> 00:03:20,610
something like that.

46
00:03:20,620 --> 00:03:29,670
So all those method names remains the same, except all the methods will get and I think suffix on their

47
00:03:29,670 --> 00:03:30,050
name.

48
00:03:30,360 --> 00:03:36,780
So other than that, they all look pretty much exactly the same, does exactly the same, and there

49
00:03:36,780 --> 00:03:37,860
is no difference on that.

50
00:03:38,280 --> 00:03:43,980
So having a clear understanding for us in playwrite with JavaScript language binding or types of language

51
00:03:43,980 --> 00:03:51,300
binding will eventually give you a good idea on Java that we worked on the earlier section and in C

52
00:03:51,300 --> 00:03:53,150
Sharp is going to be exactly the same thing.

53
00:03:53,160 --> 00:03:55,440
So that's pretty cool to see.

54
00:03:55,440 --> 00:03:57,570
That is going to be exactly all the same things.

55
00:03:57,570 --> 00:04:02,300
I mean, same classes, same interfaces, all remains the same over here.

56
00:04:02,640 --> 00:04:07,980
And if you want to set the launch options, you can set the launch options as well.

57
00:04:08,190 --> 00:04:11,830
And similarly, if you want to write like a framework, you can easily do that as well.

58
00:04:11,880 --> 00:04:18,900
Those things all remains pretty much exactly the same, like how we discussed on the Java language binding

59
00:04:18,900 --> 00:04:20,600
on this language, binding as well.
