Forums

Firefox selenium, Process unexpectedly closed with status 1

Hello, initially I would like to say that I read most of the related topics that were posted on here, and read that using Chrome instead of Firefox is preferred, however the Chrome driver seems to have very different behaviour when it is headless, on both my pc and here, which is why i prefer to use the Firefox driver. But, i keep getting this error, which i dont get on my pc:

raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 1

This is how i initalize the webdriver

options = Options()
options.add_argument("--no-sandbox")
options.add_argument("--headless")
options.add_argument("--disable-gpu")
options.add_argument("--window-size=1920,1080")
driver = webdriver.Firefox(options=options,executable_path= os.getcwd() + '/geckodriver')

The version of Firefox that is available on PythonAnywhere does not support headless use or geckodriver. You can use PyViirtualDisplay with xvfb to run the browser in non-headless mode.