CentOS 7.x Headless chrome + Selenium + ChromeDriver

CentOS 7.x环境下搭建: Headless chrome + Selenium + ChromeDriver

 

1.指定yum 源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

2.安装Chrome

curl https://intoli.com/install-google-chrome.sh | bash

检查依赖返回空基本解决

ldd /opt/google/chrome/chrome | grep "not found"

执行 

google-chrome-stable --no-sandbox --headless --disable-gpu --screenshot https://www.baidu.com/

查看是否有截图有截图成功

3.Chromedriver安装

下载后解压到/opt/drivers  给文件设置可执行权限 chorm 751 chromedriver   

CentOS 7.x Headless chrome + Selenium + ChromeDriver_第1张图片

  禁掉 sandbox 

你可能感兴趣的:(selenium,selenium,chrome)