Selenium (argument --headless) + (marionette = False) Selenium (argument --headless) + (marionette = False) selenium selenium

Selenium (argument --headless) + (marionette = False)


Ok apparently this problem is caused by the fact that the user had a very outdated version of firefox on his machine. The capabilities do not have to be set to anything that isn't default, but the browser should be updated.


I can't speak about the compatibility of capabilites and firefox_options, but I've had some success with this:

from selenium import webdriverfrom selenium.webdriver.firefox.options import Optionsfrom bs4 import BeautifulSoupdef page_souping_js(url):    options = Options()    options.set_headless(True)    driver = webdriver.Firefox(firefox_options=options)    driver.get(url)    complete_page = driver.page_source    driver.close()    page_soup = BeautifulSoup(complete_page, "lxml")    return page_soup

This should return the source html without opening the browser. Putting this through PyInstaller didn't seem to cause any issues either.

Side note, the official import statement for BeautifulSoup (according to the official documentation) is from bs4 import BeautifulSoup.


make sure you are using this path to firefox.exe file inside "App" folder. 'path\to\FirefoxPortable\App\Firefox\firefox.exe'

for 64-bit version use this path:'path\to\FirefoxPortable\App\Firefox64\firefox.exe'