Linux安装:selenium

1、安装chrome

用下面的命令安装Google Chrome

yum install -y https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

已安装:
google-chrome-stable.x86_64 0:110.0.5481.100-1

检查安装的版本

google-chrome --version

 

安装必要的库

yum install -y mesa-libOSMesa-devel gnu-free-sans-fonts wqy-zenhei-fonts

 

安装报错

Requires: libc.so.6(GLIBC_2.25)(64bit)

按提示,可以尝试安装更高版本的GLIBC。

也就是说当前你的操作系统版本与chrome版本不匹配导致的,你也可以安装匹配的chrome版本,在这里找:

http://dist.control.lth.se/public/CentOS-7/x86_64/google.x86_64/

 

2、安装 chromedriver

找到和chrome匹配的chromedriver

最新版本的:https://googlechromelabs.github.io/chrome-for-testing/(115版本以后)

所有历史版本:https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json (慢慢找)

将下载的文件解压,放在如下位置

unzip chromedriver_linux64.zip
mv chromedriver /usr/bin/

给予执行权限

chmod +x /usr/bin/chromedriver

检查安装的版本

chromedriver --version