This error can come up when you are trying to run the browser in non-headless mode on a box that doesn’t have a display (like an Ubuntu server).
You can check if that’s the cause of your Process unexpectedly closed with status: 1
error by looking at the geckodriver.log
file that is usually left in your working directory after you run your script, it should have a line like:
Error: GDK_BACKEND does not match available displays
If you see that line in the geckodriver.log
then you’ll need to switch your script to run Firefox in headless mode:
from selenium import webdriver
from selenium.webdriver import FirefoxOptions
opts = FirefoxOptions()
opts.add_argument("--headless")
browser = webdriver.Firefox(options=opts)
browser.get('http://example.com')