安装对

text
1 2 3
wget http://npm.taobao.org/mirrors/chromedriver/96.0.4664.18/chromedriver_linux64.zip

unzip chromedriver_linux64.zip 

截图测试

google-chrome-stable --headless --disable-gpu --screenshot https://www.suning.com/

[如果用户是管理员root]必须以--no-sandbox模式运行。所以标准测试命令如下:

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

安装浏览器

text
1
yum install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

然而,仍然有错误:

[0100/000000.311368:ERROR:broker_posix.cc(43)] Invalid node channel message

翻墙求助了好久,发现解决方案,仍然缺乏依赖:

text
1 2 3 4 5 6 7 8
yum install  \
 ipa-gothic-fonts \
 xorg-x11-fonts-100dpi \
 xorg-x11-fonts-75dpi \
 xorg-x11-utils \
 xorg-x11-fonts-cyrillic \
 xorg-x11-fonts-Type1 \
 xorg-x11-fonts-misc -y