linux下安装chrome和chromedriver以使用selenium

1、安装chrome

用下面的命令安装Google Chrome

yum install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

也可以先下载至本地,然后安装

wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

yum install ./google-chrome-stable_current_x86_64.rpm


安装必要的库

yum install mesa-libOSMesa-devel gnu-free-sans-fonts wqy-zenhei-fonts


2、安装 chromedriver(末尾附chrome和chromedriver的对应版本)

chrome官网 

wget https://chromedriver.storage.googleapis.com/2.38/chromedriver_linux64.zip

淘宝源(推荐)

wget http://npm.taobao.org/mirrors/chromedriver/2.41/chromedriver_linux64.zip


将下载的文件解压,放在如下位置

unzip chromedriver_linux64.zip

mv chromedriver /usr/bin/

给予执行权限

chmod +x /usr/bin/chromedriver


3、运行代码,查看是否成功(python下)

from selenium import webdriver

driver = webdriver.Chrome()


------------2019年兼容版本对照表-----------

ChromeDriver 78.0.3904.11 (2019-09-12)---------Supports Chrome version 78

ChromeDriver 77.0.3865.40 (2019-08-20)---------Supports Chrome version 77

ChromeDriver 76.0.3809.12 (2019-06-07)---------Supports Chrome version 76

ChromeDriver 75.0.3770.8 (2019-04-29)---------Supports Chrome version 75

ChromeDriver v74.0.3729.6 (2019-03-14)--------Supports Chrome v74

ChromeDriver v2.46 (2019-02-01)----------Supports Chrome v71-73

————————————————

版权声明:对照表来自 https://blog.csdn.net/yoyocat915/article/details/80580066

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。