您现在的位置是:首页 > 技术人生 > 后端技术后端技术

centos7安装chrome及对应版本驱动下载-java爬虫之selenium(一)

高晓波2020-09-28【后端技术】人已围观

简介本文记录centos7下安装chrome以及下载对应驱动,为后面使用selenium搭建运行环境

1、下载最新版chrome rpm安装包
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

2、安装chrome
rpm -ivh google-chrome-stable_current_x86_64.rpm

报错了,一大票依赖缺少:
warning: google-chrome-stable_current_x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 7fac5991: NOKEY
error: Failed dependencies:
        libXcomposite.so.1()(64bit) is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        libXcursor.so.1()(64bit) is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        libXi.so.6()(64bit) is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        libXrandr.so.2()(64bit) is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        libXtst.so.6()(64bit) is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        libappindicator3.so.1()(64bit) is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        libatk-1.0.so.0()(64bit) is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        libatk-bridge-2.0.so.0()(64bit) is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        libatspi.so.0()(64bit) is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        libcups.so.2()(64bit) is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        liberation-fonts is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        libgdk-3.so.0()(64bit) is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        libgdk_pixbuf-2.0.so.0()(64bit) is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        libgtk-3.so.0()(64bit) is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        libpango-1.0.so.0()(64bit) is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        libpangocairo-1.0.so.0()(64bit) is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        libvulkan.so.1()(64bit) is needed by google-chrome-stable-85.0.4183.121-1.x86_64
        xdg-utils is needed by google-chrome-stable-85.0.4183.121-1.x86_64


逐一安装缺少的依赖
yum install -y xxxxxx*



3、再次安装chrome,安装成功
[root@VM_0_17_centos ~]# rpm -ivh google-chrome-stable_current_x86_64.rpm
warning: google-chrome-stable_current_x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 7fac5991: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:google-chrome-stable-85.0.4183.12################################# [100%]
Redirecting to /bin/systemctl start atd.service


4、查看chrome版本
[root@VM_0_17_centos ~]# google-chrome --version
Google Chrome 85.0.4183.121 

5、下载chromedriver,下载地址https://chromedriver.storage.googleapis.com/index.html,查找对应版本chromedriver。我当前的chrome版本号为85.0.4183.121,列表中并没有,经过尝试,chromedriver 85.0.4183.87 在chrome 85.0.4183.121下可以正常使用。

 

Tags:selenium   chrome

很赞哦! ()

文章评论