基本环境:centos7,python3.x
1.安装selenium
pip3 install selenium

2.安装chrome-browser
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm --no-check-certificate
yum install ./google-chrome-stable_current_x86_64.rpm

3.下载chromedriver(注意要和chrome-browser版本对应)
wget http://chromedriver.storage.googleapis.com/2.43/chromedriver_linux64.zip
解压此文件,并将文件移动到/usr/bin目录下
unzip chromedriver_linx64.zip
mv chromedriver /usr/bin/

4.测试selenium是否可用,请执行以下python脚本,如返回html内容,则说明安装成功
python3 test.py

from selenium import webdriverurl='http://bing.com'option = webdriver.ChromeOptions()option.add_argument('--no-sandbox')option.add_argument('--headless')driver = webdriver.Chrome(chrome_options=option)driver.get(url)print(driver.page_source)