The basic environment: centos7, python3.x
1. Installation Selenium
PIP3 the 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. Download chromedriver (Note that to correspond and chrome-browser version)
wget http://chromedriver.storage.googleapis.com/2.43/chromedriver_linux64.zip
to decompress the file, and moves to the next file / usr / bin directory
unzip chromedriver_linx64. ZIP
mv chromedriver / usr / bin /
4. Test selenium is available, do the following python script, such as the return html content, the installation is successful
python3 test.py
from selenium import webdriver
url='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)