Reputation: 581
I am trying to make firefox headless and doing exactly as shown in the documentation.
This shouldn't be doing what it is supposed to the firefox window is appearing even when I am adding the headless argument
cap = DesiredCapabilities().FIREFOX
cap["marionette"] = False
options = webdriver.FirefoxOptions()
options.add_argument('-headless')
driver = webdriver.Firefox(firefox_options=options, capabilities=cap)
this should not open the firefox window but it opening the window I have never had this kind of problem with chrome and chromedriver
I have downloaded the 64-bit geckodriver binary and it is in PATH what am I doing wrong here?
Upvotes: 1
Views: 778
Reputation: 5214
You need to use Options()
not webdriver.FirefoxOptions()
:
from selenium.webdriver.firefox.options import Options
options = Options()
options.add_argument('--headless')
Hope this helps you!
Upvotes: 1
Reputation: 555
Try following code block:
from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
Upvotes: 1