在centos中安装chrome,为selenium做准备

一、安装chrome浏览器

1.系统需求

CentOS 7 系统必须是 64 位系统,Chrome 没有 32 位系统的软件包。

2.在 CentOS 7 系统中添加谷歌官方 Yum 软件源

在 CentOS 7 系统下的 /etc/yum.repos.d/ 文件夹中创建 google-chrome.repo 文件:

sudo vi /etc/yum.repos.d/google-chrome.repo

添加如下 Yum 软件源信息:

[google-chrome]

name=google-chrome

baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch

enabled=1

gpgcheck=0

gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub

3.查看谷歌 Chrome 浏览器的软件包信息

sudo yum info google-chrome-stable

系统可能会显示如下信息:

可安装的软件包

名称 :google-chrome-stable

架构 :x86_64

版本 :67.0.3396.87

发布 :1

大小 :50 M

源 :google-chrome/x86_64

简介 : Google Chrome

网址 :https://chrome.google.com/

协议 : Multiple, see https://chrome.google.com/

描述 : The web browser from Google

:

: Google Chrome is a browser that combines a minimal design with

: sophisticated technology to make the web faster, safer, and easier.

从显示信息上可以看出当前的 Chrome 版本是 67。

4.在 CentOS 7 系统中安装 Chrome 浏览器稳定版

sudo yum install google-chrome-stable

5.检查版本

[root@localhost ~]# google-chrome-stable --version

Google Chrome 109.0.5414.119

二、安装驱动

知道了chrome的版本后,需要再安装对应版本的驱动:

1、方式一:

在这里查看:CNPM Binaries Mirror 找到与上面浏览器一样的版本下载.

2、方式二:

有时可能找不到这么高的版本,可以使用稍低一点的。

3、方式三:

稍低版本不行,那你可以访问 Chrome for Testing availability 这个地址去下载更新chromedriver。

4、下载

(1)在windows浏览器找到对应系统的包之后,直接下载。然后通过,rz命令再上传到centos上。

(2)使用复制下载链接,在centos的目录中,自己找个想把包放到的目录。使用下面命令:

wget http://xxxxx

5、下载完成后,要解压一下:

unzip xxxx.zip

没有unzip命令的自己安装一下

6、把解压中的chromedriver移动到/usr/bin下

mv chromedriver /usr/bin

7、进入到/usr/bin中,把chromedriver设置为可执行文件

复制代码
chmod u+x chromedriver
相关推荐
wusam2 分钟前
螺蛳壳里做道场:老破机搭建的私人数据中心---Centos下Docker学习04(环境准备)
学习·docker·centos
康熙38bdc1 小时前
Linux 进程优先级
linux·运维·服务器
hhzz1 小时前
Linux Shell编程快速入门以及案例(Linux一键批量启动、停止、重启Jar包Shell脚本)
android·linux·jar
只是有点小怂1 小时前
parted是 Linux 系统中用于管理磁盘分区的命令行工具
linux·运维·服务器
三枪一个麻辣烫2 小时前
linux基础命令
linux·运维·服务器
cuisidong19972 小时前
如何在 Kali Linux 上安装 Google Chrome 浏览器
linux·运维·chrome
光通信学徒3 小时前
ubuntu图形界面右上角网络图标找回解决办法
linux·服务器·ubuntu·信息与通信·模块测试
南种北李3 小时前
Linux自动化构建工具Make/Makefile
linux·运维·自动化
小飞猪Jay3 小时前
面试速通宝典——10
linux·服务器·c++·面试
暗恋 懒羊羊4 小时前
Linux 生产者消费者模型
linux·开发语言·ubuntu