无头模式,Windows和Linux

----windows

from selenium  import webdriver

from selenium .webdriver.common.by import By

import ttime

chrome_options =webdriver.ChromeOptions()

chrome_options.add_argument(‘--headless‘)

chrome_options.add_argument(‘--disable-gpu‘)

chrome_options.add_argument(‘--window-size =1920,1050‘)

driver =webdriver.Chrome(options = chrome_options)

相关推荐