Centos7 之安装 Headless Chrome
Headless Chrome
什么是Headless Chrome?
在Chrome59中开始搭载Headless Chrome。这是一种在无需显示headless的环境下运行Chrome 浏览器的方式。从本质上来说,就是不用Chrome浏览器来运行Chrome的功能!它将Chromium和Blink渲染引擎提供的所有现代Web平台的功能都带入了命令行。
intoli
开始安装之前我们来了解一下这家公司
我们(intoli)是一家在数据采集,处理和分析方面具有深厚专业知识的咨询机构。
安装
intoli在其博客上介绍了几种安装Headless Chrome的方式,我们采用如下方式安装:
1 | curl https://intoli.com/install-google-chrome.sh | bash |
安装完成提示:
1 | Successfully installed Google Chrome! |
运行 chrome
我们可以通过如下命令来启动Chrome,同时将博客截图保存
1 | google-chrome-stable --no-sandbox --headless --disable-gpu --screenshot https://www.jakehu.me |
Chromedriver
chromedriver可以前往淘宝镜像下载,同时通过下面命令进行验证:
1 | ./chromedriver |
如果有如上输出则表示驱动正常运行