WEBVTT 1 00:00:00.840 --> 00:00:02.780 Hi guys and welcome back. 2 00:00:02.780 --> 00:00:06.230 In this section, we're going to look at browser automation. 3 00:00:06.230 --> 00:00:09.440 Browser automation is really similar to web scraping 4 00:00:09.440 --> 00:00:12.510 but instead of requesting the page's content 5 00:00:12.510 --> 00:00:14.250 using the requests module, 6 00:00:14.250 --> 00:00:16.590 we're actually going to launch the Chrome browser 7 00:00:16.590 --> 00:00:17.960 and we're gonna open the page 8 00:00:17.960 --> 00:00:20.730 and we're gonna use Chrome to navigate through the page 9 00:00:20.730 --> 00:00:23.660 and get the contents using Chrome. 10 00:00:23.660 --> 00:00:24.760 That has a couple of benefits. 11 00:00:24.760 --> 00:00:29.144 The first one is that Chrome can execute JavaScript. 12 00:00:29.144 --> 00:00:31.785 The code from the last section would find some problems 13 00:00:31.785 --> 00:00:34.238 if there is JavaScript on the page. 14 00:00:34.238 --> 00:00:36.870 Just because when you get the page content 15 00:00:36.870 --> 00:00:38.320 with the requests module, 16 00:00:38.320 --> 00:00:40.560 it doesn't run the JavaScript code, 17 00:00:40.560 --> 00:00:42.620 that has to be run on a browser 18 00:00:42.620 --> 00:00:44.710 or another JavaScript engine. 19 00:00:44.710 --> 00:00:46.580 That means that if there was JavaScript code, 20 00:00:46.580 --> 00:00:48.840 the page wouldn't work as expected. 21 00:00:48.840 --> 00:00:50.900 Using Chrome fixes that problem 22 00:00:50.900 --> 00:00:52.360 but of course you do end up 23 00:00:52.360 --> 00:00:54.990 with a much slower-running programme. 24 00:00:54.990 --> 00:00:57.314 Now you have to actually open the Chrome browser, 25 00:00:57.314 --> 00:01:00.150 you have to actually navigate through the page 26 00:01:00.150 --> 00:01:02.950 using the mouse, pretending to be a user 27 00:01:02.950 --> 00:01:05.140 with the Chrome browser and so on. 28 00:01:05.140 --> 00:01:07.980 So it is much slower and more cumbersome, 29 00:01:07.980 --> 00:01:10.670 it takes up a lot more resources in your computer. 30 00:01:10.670 --> 00:01:14.260 So this is not the solution to all problems, 31 00:01:14.260 --> 00:01:15.860 you should still use what we learned 32 00:01:15.860 --> 00:01:18.100 in the last section where possible, 33 00:01:18.100 --> 00:01:20.790 but if it's not possible because the page has JavaScript 34 00:01:20.790 --> 00:01:23.110 or because you wanna pretend to be an actual user 35 00:01:23.110 --> 00:01:26.530 instead of a robot, then you can use Chrome 36 00:01:26.530 --> 00:01:30.050 and what we'll be learning in this section to do that. 37 00:01:30.050 --> 00:01:32.100 So thanks for joining me in this section, 38 00:01:32.100 --> 00:01:33.713 I'll see you in the next video.