[英]Firefox Python selenium not going headless
我試圖使Firefox無頭,並且完全按照文檔中所示進行操作。
即使當我添加無頭參數時,這也不應該做應該做的事情,而Firefox窗口卻出現了
cap = DesiredCapabilities().FIREFOX
cap["marionette"] = False
options = webdriver.FirefoxOptions()
options.add_argument('-headless')
driver = webdriver.Firefox(firefox_options=options, capabilities=cap)
這不應該打開Firefox窗口,但是會打開窗口 我從未遇到過chrome和chromedriver這樣的問題
我已經下載了64位geckodriver二進制文件,並且在PATH中我在這里做錯了什么?
嘗試以下代碼塊:
from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
您需要使用Options()
而不是webdriver.FirefoxOptions()
:
from selenium.webdriver.firefox.options import Options
options = Options()
options.add_argument('--headless')
希望這對您有所幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.