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?
Try following code block:
from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.