基本环境:centos7,python3.x
pip3 install selenium
wget https://dl.google.com/linux/d... --no-check-certificate yum install ./google-chrome-stable_current_x86_64.rpm
wget http://chromedriver.storage.g... 解压此文件,并将文件移动到/usr/bin目录下 unzip chromedriver_linx64.zip mv chromedriver /usr/bin/
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)