1
00:00:01,690 --> 00:00:09,900
The code we developed in the previous video needs two extra lines to be able to work on a local IDE,

2
00:00:09,940 --> 00:00:12,490
such as PyCharm or Visual Studio code.

3
00:00:12,970 --> 00:00:15,010
So on Rep, it worked well.

4
00:00:15,230 --> 00:00:23,020
But if I get this codeand I put it on PyCharm, for example, on my Windows computer,

5
00:00:26,810 --> 00:00:27,830
and then I run it.

6
00:00:29,440 --> 00:00:30,700
I'm going to get this error.

7
00:00:32,020 --> 00:00:35,980
It says that chrome driver needs to be in path.

8
00:00:36,670 --> 00:00:40,480
So chromedriver is a file which you need to download.

9
00:00:41,170 --> 00:00:48,520
So lets download chromedriver and place it in a folder and then connect to that folder with our code.

10
00:00:49,390 --> 00:00:56,380
So go to your browser and then do a search for Chrome driver and then go to this web page.

11
00:00:59,240 --> 00:01:06,230
So you want to download one of these files, but first you want to know what version of Chrome you have.

12
00:01:06,830 --> 00:01:10,080
So I assume you are on your Chrome browser.

13
00:01:11,150 --> 00:01:16,640
An easy way to find the version of your Chrome browser is by searching what's my browser version on

14
00:01:16,640 --> 00:01:17,020
Google.

15
00:01:17,030 --> 00:01:19,010
And then visit this page.

16
00:01:20,170 --> 00:01:23,470
And this says that I'm using Chrome 100.

17
00:01:23,560 --> 00:01:25,480
That's the version on Windows.

18
00:01:26,170 --> 00:01:31,780
So I go back to the ChromeDriver web page and I download the Chrome Driver 100.

19
00:01:32,800 --> 00:01:36,550
Version and I get the Win32.zip version.

20
00:01:36,790 --> 00:01:40,240
This one in here. That will give me a zip file.

21
00:01:43,050 --> 00:01:44,280
And I'll just Copy it

22
00:01:44,310 --> 00:01:47,040
in my downloads folder.

23
00:01:47,190 --> 00:01:51,810
So in my downloads folder, now I have this chromedriver.exe file.

24
00:01:52,680 --> 00:01:56,370
Well, then we want to go to our code.

25
00:01:59,700 --> 00:02:03,390
And first, we want to import the service class.

26
00:02:04,960 --> 00:02:19,510
So from selenium.webdriver.chrome.service import Service. Lowercase s here, uppercase S.

27
00:02:19,930 --> 00:02:28,420
Then we want to create a service object instance using that service class which as input gets a string,

28
00:02:28,630 --> 00:02:35,140
the string should be the absolute path pointing to the chrome driver file.

29
00:02:35,440 --> 00:02:39,130
So in my case my file is in downloads.

30
00:02:40,310 --> 00:02:43,190
You see downloads folder, chromedriver.exe.

31
00:02:43,460 --> 00:02:53,260
Therefore I want to go here and create the absolute path which is c, colon, backslash, backslash, users.

32
00:02:53,480 --> 00:03:00,530
This should be similar in your case, but now I want to place here my username, my windows username

33
00:03:00,740 --> 00:03:03,860
and I'll also tell you the path of your Mac

34
00:03:04,280 --> 00:03:05,780
if you're using a mac computer.

35
00:03:06,140 --> 00:03:13,300
So you should replace this to your windows username and then download, and then backslash.

36
00:03:13,310 --> 00:03:13,900
Backslash.

37
00:03:14,390 --> 00:03:16,180
Chromedriver.exe.

38
00:03:16,910 --> 00:03:22,010
So this assumes that you also place that file in your downloads folder.

39
00:03:22,640 --> 00:03:30,410
Then you want to go down here when you have this line, driver is equal to webdriver dot chrome.

40
00:03:30,620 --> 00:03:31,850
And you want to pass here

41
00:03:32,120 --> 00:03:39,860
another argument, service is equal to service. And we also have the options argument.

42
00:03:39,860 --> 00:03:41,390
So I'm not touching that.

43
00:03:42,140 --> 00:03:45,350
So service is the name of the argument is equal to service.

44
00:03:45,350 --> 00:03:47,960
That variable, and that's it.

45
00:03:48,290 --> 00:03:49,280
I can run this now.

46
00:03:49,280 --> 00:03:51,560
And this

47
00:03:51,560 --> 00:03:55,040
will successfully start my Chrome browser.

48
00:03:56,380 --> 00:03:57,510
Scrape

49
00:03:57,520 --> 00:03:58,450
that text.

50
00:03:59,520 --> 00:04:07,470
And we should see that text printed out in here, on PyCharm. If you were using Mac,

51
00:04:07,560 --> 00:04:09,720
this path should be slightly different.

52
00:04:10,110 --> 00:04:12,360
It would be users.

53
00:04:15,330 --> 00:04:22,410
With slashes so no back slashes but slashes your username slash again downloads.

54
00:04:23,950 --> 00:04:26,320
Chrome driver and that's it.

55
00:04:26,920 --> 00:04:28,470
So that's a B in quotes.

56
00:04:28,870 --> 00:04:32,380
And you should plays that string instead of that.

57
00:04:33,670 --> 00:04:34,190
And that's it.

58
00:04:34,190 --> 00:04:40,390
So that's how Selenium works on your local I.D. So you should do this.

59
00:04:40,390 --> 00:04:43,750
You should add this line and that line and that.

60
00:04:44,990 --> 00:04:53,270
Argument for all the scripts that we will be developing in this section where we work with Selenium.

61
00:04:53,420 --> 00:04:56,360
So please keep that in mind and I'll talk to you in the next video.

62
00:04:56,500 --> 00:04:56,720
See?

