headless mode,说白了就是在没有图形界面的情况下对网站访问进行截图查看访问效果
下载最新版已编译好的包,低版本不支持headless mode截屏,至少60.3.0不支持
最新版已编译好的包,低版本不支持headless mode截屏,至少60.3.0不支持
1.下载最新版(以firefox官网为准)
yum install firefox -y(不是最新版) firefox -version版本是60.3.0 执行firefox -screenshot test.png www.baidu.com 报错如下 Failed to open connection to "session" message bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11 Running without a11y support! * You are running in headless mode. 因为不行,所以要下载最新版,最新版支持支持headless mode截屏 wget https://download-installer.cdn.mozilla.net/pub/firefox/releases/63.0.1/linux-x86_64/zh-CN/firefox-63.0.1.tar.bz2
2.解压 tar jxvf firefox-63.0.1.tar.bz2 3.安装字体 yum install system-config-language wqy-unibit-fonts cjkuni-ukai-fonts lrzsz -y 4.设置中文显示
system-config-language --text 设置简体中文显示
source /etc/locale.conf
echo $LANG 显示zh_CN.UTF-8即可
5.执行命令获取截屏
./firefox/firefox -screenshot test.png www.baidu.com
6.下载到本地查看图片
sz test.png
用画图工具查看,显示正常
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。