Install chrome
yum install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
Install dependent libraries
Install necessary libraries yum install mesa-libOSMesa-devel gnu- free -sans-fonts wqy-zenhei-fonts
Install chromedriver
wget http: // npm.taobao.org/mirrors/chromedriver/2.41/chromedriver_linux64.zip #Unzip the downloaded file unzip chromedriver_linux64. zip mv chromedriver / usr / bin / #give execution permission chmod + x / usr / bin / chromedriver
Code testing
from selenium.webdriver.chrome.options import Options from selenium import webdriver from time import sleep chrome_options = Options () "" "The " –no- sandbox "parameter is to allow Chrome to run with root permissions. The " --headless "parameter is not to open the graphics Interface "" " chrome_options.add_argument ( ' --no-sandbox ' ) chrome_options.add_argument ( ' --disable-dev-shm-usage ' ) chrome_options.add_argument ( ' --headless ' ) chrome_options.add_argument ( ' blink-settings = imagesEnabled = false ') chrome_options.add_argument('--disable-gpu') browser = webdriver.Chrome(chrome_options=chrome_options) browser.get('https://www.taobao.com/') sleep(2) page_text = browser.page_source print(page_text[0:100])