chromedriver安装

爬虫开发过程中使用selenium +webdriver打开chrome,说一下chrome dirver的安装

1、我的chrome版本65.0.3325.181
打开如下页面:
https://sites.google.com/a/chromium.org/chromedriver/downloads
对照下载说明,找到对应的ChromeDriver版本 2.38
chromedriver安装

2、打开如下网页:
http://chromedriver.storage.googleapis.com/index.html
chromedriver安装

选取2.38文件夹,下载

chromedriver安装

3、解压缩

把exe文件放置到如下位置之一:

(1)将解压后的exe文件放到chrome的安装目录下 (eg:C:\Program Files (x86)\Google\Chrome\Application)
(2)直接放到Python的安装目录下 (eg:D:\tools\Python3.5.3)

4、配置环境变量

对变量Path进行编辑,在变量值后面加入chrome或Python的安装目录


5、用 Chrome 浏览器来测试


from selenium import webdriver
browser = webdriver.Chrome()
browser.get('http://www.baidu.com/')