CentOS7安装chrome和chromedriver

一、最新版RPM安装

1、安装依赖

yum install liberation-fonts -y

yum install vulkan -y

yum -y install redhat-lsb*

yum -y install libXss*

yum -y install libappindicator*

yum -y install libgbm

 

2、下载google-chrome RPM

wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

3、安装google-chrome

rpm -ivh google-chrome-stable_current_x86_64.rpm

4、查看google-chrome版本

google-chrome --version

二、历史版本安装

1、下载指定版本安装包

下载地址:Chromium Downloads Tool

以105版本为例,一般存在以下三个通道版本,可按照需要点击Get downloads下载:

dev:开发版

beta:测试版

stable:稳定版

2、使用unzip解压

unzip Linux_x64_1027022_chrome-linux.zip

3、查看版本

进入解压缩目录,输入命令

./chrome --version

三、下载chromedriver

1、根据google-chrome版本号下载对应的驱动

下载链接:CNPM Binaries Mirror

2、使用unzip解压

unzip chromedriver_linux64.zip

3、设置可执行权限

chmod +x chromedriver

4、设置参数(Java)

ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
options.addArguments("--ignore-certificate-errors");
options.addArguments("--window-size=1920,1080");
options.addArguments("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36");

更多参数,请查看:List of Chromium Command Line Switches « Peter Beverloo

  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值