导入selenium.webdriver.chrome.options import Options
增加两个参数即可,“--headless” “--disable-gpu”
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from PIL import Image,ImageEnhance
path = 'C:/dd/chromedriver.exe' # chromedriver.exe 驱动的路径
#打开浏览器
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
# 创建浏览器对象
driver = webdriver.Chrome(executable_path=path, chrome_options=chrome_options)