1. 程式人生 > >selenium設定谷歌無頭瀏覽器

selenium設定谷歌無頭瀏覽器

當然你得先下載谷歌驅動chromedriver.exe,安裝selenium

from selenium import webdriver
from selenium.webdriver.chrome.options import Options


chrome_options = Options()
chrome_options.add_argument('--headless')
driver = webdriver.Chrome(chrome_options=chrome_options,executable_path = 'D:\APPS\dir\chromedriver.exe'
)