Linux安装chrome浏览器

1.下载安装包

[root@xiaobing chrome]# wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
--2024-01-12 15:25:47--  https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
Resolving dl.google.com (dl.google.com)... 220.181.174.161
Connecting to dl.google.com (dl.google.com)|220.181.174.161|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 107103133 (102M) [application/x-rpm]
Saving to: ‘google-chrome-stable_current_x86_64.rpm’

100%[========================================================================================================================================================================================================================================================>] 107,103,133 12.0MB/s   in 7.6s   

2024-01-12 15:25:55 (13.4 MB/s) - ‘google-chrome-stable_current_x86_64.rpm’ saved [107103133/107103133]

2.尝试安装

[root@xiaobing chrome]# yum install google-chrome-stable_current_x86_64.rpm
。。。
Total size: 356 M
Total download size: 33 M
Installed size: 432 M
Is this ok [y/d/N]: y
。。。
Installed:
  google-chrome-stable.x86_64 0:120.0.6099.216-1  
Complete!

3.验证一下

[root@xiaobing chrome]# google-chrome --version
Google Chrome 120.0.6099.216 

4.下载chrome浏览器驱动

//老版本chrome驱动下载
https://registry.npmmirror.com/binary.html?path=chromedriver/
//新版本chrome驱动下载
https://googlechromelabs.github.io/chrome-for-testing/

5.卸载chrome

//检查安装版本信息
[root@xiaobing ~]# rpm -qa |grep -i chrome
google-chrome-stable-120.0.6099.216-1.x86_64
//卸载命令:
[root@xiaobing ~]# rpm -e --nodeps google-chrome-stable-120.0.6099.216-1.x86_64

 6.linux指定版本安装chrome

//chrome win/mac/linux/各平台历史版本
https://www.chromedownloads.net/
//下载google-chrome-stable_deb_rpm_98.0.4758.102.zip解压
//安装
[root@xiaobing chrome]# yum install 98.0.4758.102-google-chrome-stable_current_x86_64.rpm
//查看版本
[root@xiaobing chrome]# google-chrome --version
Google Chrome 98.0.4758.102
//chromedriver驱动下载
https://registry.npmmirror.com/binary.html?path=chromedriver/98.0.4758.102/
//java+selenium 使用驱动打开浏览器的时候报错
ERROR 14758 --- [nio-8099-exec-7] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: 
The driver is not executable: /usr/local/api/driver/chromedriver] with root cause
//chromedriver没有执行权限导致的报错
[root@xiaobing driver]# chmod 777 chromedriver 

 

posted @ 2024-01-12 15:34  o小兵o  阅读(663)  评论(0编辑  收藏  举报