以下是引用Z89在2022-4-26 14:42:53的发言:
請問執行 selenium 自動安裝webdriver後如何起動無頭模式??
以下是有頭,我想改為無頭該怎麼改????感謝~~
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
url = 'https://'
driver.get(url)
程序代码:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
driver = webdriver.Chrome(ChromeDriverManager().install(),chrome_options=chrome_options)
url = 'https://'
driver.get(url)