chrome安装和chromedriver下载
chrome下载安装
yum install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
chromedriver下载,我下载的是最新版本。chrome也是最新版本
https://npm.taobao.org/mirrors/chromedriver/2.40/chromedriver_linux64.zip
或者 以下
centos7 安装 google-chrome
(1) 添加chrome的repo源
vi /etc/yum.repos.d/google.repo
[google]name=Google-x86_64baseurl=http://dl.google.com/linux/rpm/stable/x86_64enabled=1gpgcheck=0gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
(2)安装
yum update , 然后yum install google-chrome-stable
这时候在非root账号下运行google-chrome会输出没有显示器,无法启动之类的。
不知道为什么不能在非root账号下运行。
所以在运行时一定要切换到ROOT用户!!!
2, 安装Xvfb
yum update
yum install Xvfb
yum install libXfont
yum install xorg-x11-fonts*
(2)下载chromedriver
从https://sites.google.com/a/chromium.org/chromedriver/home下载chromedriver
配置在PATH路径或者在脚本中指定路径