1
00:00:01,310 --> 00:00:03,530
Hi, guys, welcome back to Section two.

2
00:00:04,010 --> 00:00:09,530
My name is Karthick and I am from Israel Automation Dotcom, and you are in the scores into increased

3
00:00:09,530 --> 00:00:11,000
automation with playwrite.

4
00:00:11,510 --> 00:00:14,540
In our last section we discussed about an introduction to playwrite.

5
00:00:14,810 --> 00:00:19,700
We saw how we can install playwrite, how we can play around with playwright, with playwright Seelie,

6
00:00:19,910 --> 00:00:22,490
and also we compared playwright with puppeteer.

7
00:00:22,490 --> 00:00:25,970
And we saw how the history and evolution of playwright happened and stuff.

8
00:00:26,360 --> 00:00:31,970
But in this section we are going to start making ourselves more comfortable and strong with the basics

9
00:00:31,970 --> 00:00:37,430
of playwrite so that we can be more comfortable to work with some of the advanced concepts later in

10
00:00:37,430 --> 00:00:37,950
this course.

11
00:00:38,300 --> 00:00:43,390
So this section is all about a basic building block of playwrights.

12
00:00:43,400 --> 00:00:44,970
So that's what we'll be focusing on.

13
00:00:45,380 --> 00:00:51,680
So the first and foremost important thing about playwright is the concepts of Browser's Browsr context

14
00:00:51,680 --> 00:00:52,930
page and frames.

15
00:00:53,240 --> 00:00:58,890
So these are the four most important concept that we really need to know while we talk about playwright.

16
00:00:59,390 --> 00:01:06,770
So if you remember, if you already have some experience on selenium or Cyprus, let's take selenium,

17
00:01:06,770 --> 00:01:07,540
for example.

18
00:01:07,940 --> 00:01:14,080
The most important thing that we always try to do in selenium is we always do what is called the driver.

19
00:01:14,090 --> 00:01:20,510
Driver is called the new chrom driver or Firefox's driver or IHI driver or something like that.

20
00:01:20,870 --> 00:01:22,220
So that's what we always do.

21
00:01:22,340 --> 00:01:30,290
And using this driver object, we try to perform something like Find Elements by XPath, our constructors

22
00:01:30,290 --> 00:01:31,120
and things of that nature.

23
00:01:31,130 --> 00:01:34,970
So there was only one option that we create and then we start working with it.

24
00:01:34,970 --> 00:01:40,160
And once we call this the driver, driver is equal to new chromed driver.

25
00:01:40,400 --> 00:01:43,400
It is going to invoke and a whole new browser for you.

26
00:01:43,400 --> 00:01:48,620
And it gives you all the ability that you can do something like navigating to the page and then perform

27
00:01:48,620 --> 00:01:50,240
an action on that particular page and stuff.

28
00:01:50,240 --> 00:01:53,660
So that's what that particular line of code actually does.

29
00:01:53,960 --> 00:01:57,080
But here in playwrite, it's a bit different.

30
00:01:57,110 --> 00:02:01,550
Basically, we always try to invoke what is called as a browser.

31
00:02:01,550 --> 00:02:07,190
If you remember in our last video, we called something called as chromium dot launch that actually

32
00:02:07,190 --> 00:02:09,680
invoked what is called as a browser.

33
00:02:09,920 --> 00:02:13,910
And within that particular browser, we invoked what is called as a [REMOVED].

34
00:02:14,420 --> 00:02:16,100
And it can be a page.

35
00:02:16,100 --> 00:02:17,900
It can be a frame if you want to.

36
00:02:18,080 --> 00:02:21,320
You can do whatever you want to and then you can basically work with it.

37
00:02:21,620 --> 00:02:23,480
Basically what you call a page.

38
00:02:23,480 --> 00:02:27,500
It is like a type that you invoke within a browser.

39
00:02:27,740 --> 00:02:31,070
So if you call a page, there's basically a tab within the browser.

40
00:02:31,610 --> 00:02:35,530
But if you remember well, we launched the browser for the first time.

41
00:02:35,540 --> 00:02:42,350
It is a bit slower because you are invoking a whole browser while you tried to run that particular operation,

42
00:02:42,710 --> 00:02:44,480
which is very costly operation.

43
00:02:44,750 --> 00:02:50,720
And if you're going to run the same test, like many times with different pages or you're going to do

44
00:02:50,720 --> 00:02:56,270
the same test with different screen resolutions and things of that nature, if you invoke browser each

45
00:02:56,270 --> 00:03:00,980
and every time, it's going to slow up your machine a lot, which certainly does at the moment.

46
00:03:00,980 --> 00:03:05,750
I mean, if you call the driver drivers got a new chrome driver, it's always going to bring up the

47
00:03:05,750 --> 00:03:07,820
whole full blown browser for you.

48
00:03:07,970 --> 00:03:10,490
And that's what this operation is going to do for you as well.

49
00:03:10,760 --> 00:03:18,290
And that's why in playwright or puppeteer, the team actually has what is called as a browser context.

50
00:03:18,620 --> 00:03:25,010
So this browser context is basically like an context within the existing opened browser.

51
00:03:25,490 --> 00:03:31,100
So if you open a Chrome browser within the Chrome browser, you can create what is called as a browser

52
00:03:31,100 --> 00:03:37,130
context, which is like a lightweight context of the particular browser, but it is more like an incognito

53
00:03:37,280 --> 00:03:38,780
context of the browser.

54
00:03:38,780 --> 00:03:44,780
So whatever the main browser actually has got is not going to be impacted to this particular browser

55
00:03:44,780 --> 00:03:45,230
context.

56
00:03:45,230 --> 00:03:51,350
So if you open, let's say on this particular page of the browser, you open like automation, that

57
00:03:51,350 --> 00:03:57,020
in browser context it doesn't even care about that because it is like a separate Incognito section.

58
00:03:57,140 --> 00:04:01,510
And the browser context also has what is called US pages and frames and things of that nature.

59
00:04:01,700 --> 00:04:08,000
So that's what is this particular whole journey of the browsers browser context page and frames is all

60
00:04:08,000 --> 00:04:08,240
about.

61
00:04:08,240 --> 00:04:11,000
And that's how it's been designed in playwrite.

62
00:04:11,210 --> 00:04:15,470
And that's exactly what we'll be discussing in a couple of this video in the section.

63
00:04:15,650 --> 00:04:20,270
And then following that, we'll be talking about selectors and how to work with selectors.

64
00:04:20,600 --> 00:04:25,130
What are the different weighting mechanisms available and how the audio it actually works and things

65
00:04:25,130 --> 00:04:25,620
of that nature.

66
00:04:25,640 --> 00:04:30,590
So these are some of the most building block things that we really need to know about what we talk about

67
00:04:30,590 --> 00:04:31,450
playwrite itself.
