linux下启动selenium爬虫并安装谷歌浏览器和驱动

一.升级yum

[root@selenium ~]# yum update -y
[root@selenium ~]# yum -y groupinstall "Development tools"
[root@selenium ~]# yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel psmisc libffi-devel

二.配置谷歌浏览器安装

第一步

[root@selenium ~]# vim /etc/yum.repos.d/google-chrome.repo

第二步

#按i进入编辑模式粘贴内容
[google-chrome]
name=google-chrome
baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
#:wq保存退出

第三步

[root@selenium ~]# yum -y install google-chrome-beta.x86_64 --nogpgcheck
#你也可以查看你的版本yum list | grep chrome
#安装是否成功查询
[root@selenium ~]# google-chrome --version

三.安装驱动

驱动去官网下载:https://sites.google.com/a/chromium.org/chromedriver/downloads
上传至于/usr/local/bin/文件目录
给与权限即可

[root@selenium ~]#  chmod 777 /usr/local/bin/chromedriver

四.卸载驱动(需要卸载可操作此步骤)

# yum remove google-chrome

删除旧驱动包文件

[root@selenium ~]# cd /usr/local/bin/
[root@selenium bin]# ls
chromedriver
[root@selenium bin]# rm -rf chromedriver

上传新的驱动

[root@selenium bin]# rz chromedriver
chromedriver

安装新的浏览器

[root@selenium bin]# yum -y install google-chrome-beta.x86_64 --nogpgcheck

给与权

[root@selenium bin]# chmod 777 /usr/local/bin/chromedriver

从新安装驱动完成
原文地址:https://www.cnblogs.com/tjp40922/p/15613972.html