headless chrome

安装谷歌浏览器

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

测试结果

google-chrome -version

截屏测试

google-chrome --headless --disable-gpu --print-to-pdf http://www.baidu.com --no-sandbox

 

下载chromedriver
推荐两个地址
国外:http://chromedriver.storage.googleapis.com/index.html
国内:http://npm.taobao.org/mirrors/chromedriver/
测试是否可用
先授权改driver文件权限,为了防止权限不足不能执行,然后再执行

chmod -R 777 ./chromedriver
./chromedriver  --port=8888

原文地址:https://www.cnblogs.com/dshvv/p/13994284.html