vim /etc/yum.repo.d/google-chrome111.repo
baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64
gpgkey=https://dl.google.com/linux/linux_signing_key.pub
#安装
[root@harxxx ~]# yum -y install google-chrome-stable --nogpgcheck
#查看-版本-信息
[root@har ~]# google-chrome -version
Google Chrome 91.0.4472.106
[root@har ~]#
#直接输入百度及搜索内容
#截屏百度
[root@harbor tmp]# google-chrome --no-sandbox --headless --disable-gpu
–screenshot https://www.baidu.com/
[0615/170830.274431:WARNING:headless_browser_main_parts.cc(106)] Cannot create Pref Service with no user data dir.
[0615/170830.329462:ERROR:gpu_init.cc(440)] Passthrough is not supported, GL is swiftshader
[0615/170831.542038:INFO:headless_shell.cc(648)] Written to file screenshot.png.
#截屏百度
[root@harbor tmp]# google-chrome --no-sandbox --headless --disable-gpu
–screenshot https://www.baidu.com/
[0615/170830.274431:WARNING:headless_browser_main_parts.cc(106)] Cannot create Pref Service with no user data dir.
[0615/170830.329462:ERROR:gpu_init.cc(440)] Passthrough is not supported, GL is swiftshader
[0615/170831.542038:INFO:headless_shell.cc(648)] Written to file screenshot.png.
linux会在命令行搜索并保存 足球宝贝的搜索结果
#我们看看都搜到了什么
[root@harbor tmp]# google-chrome --no-sandbox --headless --disable-gpu
--screenshot https://www.baidu.com/s?wd=%E8%B6%B3%E7%90%83%E5%AE%9D%E8%B4%9D
[0615/170830.274431:WARNING:headless_browser_main_parts.cc(106)] Cannot create Pref Service with no user data dir.
[0615/170830.329462:ERROR:gpu_init.cc(440)] Passthrough is not supported, GL is swiftshader
[0615/170831.542038:INFO:headless_shell.cc(648)] Written to file screenshot.png.
[root@localhost tmp]# google-chrome-stable --no-sandbox --headless --disable-gpu
–dump-dom https://www.baidu.com/
本文转自:https://blog.csdn.net/weixin_42350212/article/details/124368382
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70003733/viewspace-2894891/
,如需转载,请注明出处,否则将追究法律责任。