我试图运行铬驱动器无头。为了做到这一点,我在创建我的驱动程序的实例时传递了-无头参数,但是它仍然在显示一个浏览器。
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from bs4 import BeautifulSoup
from fake_useragent import UserAgent
ua = UserAgent()
user_agent = ua.random
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument('--disable-gpu')
#chrome_options.add_argument("--window-size=1920x1080")
#chrome_options.add_argument(f'user-agent={user_agent}')
driver = webdriver.Chrome(chrome_options=chrome_options)有人能帮我弄清楚为什么chrome会在我以为--无头的争论会掩盖它的时候,出现一个可见的网页浏览器吗?
发布于 2018-03-31 04:28:24
有几件事你应该确保
https://stackoverflow.com/questions/49583928
复制相似问题