OS: Ubuntu 18.04.3 LTS
Geckodriver version: 0.26
Firefox version: 76.0.1
Python version: 3.6.9
Selenium version: 3.141.0
My code:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver_options = Options()
driver_options.headless = True
browser = webdriver.Firefox(options=driver_options)
... do stuff
First of all, this setup runs on my mac fine, when I send it to production I get that error. I've been trying to fix this for two days.
I found two main things that can cause this problem:
Versions match.
As this post says:
WebDriverException: Message: invalid argument: can't kill an exited process with GeckoDriver, Selenium and Python on RaspberryPi3
I checked my versions and they are compatibleGeckodriver is in path
I added a softlink right next to my code so it's able to find both the geckodriver and firefoxBoth geckodriver and firefox have 777 permissions
If I run firefox in headless mode from the terminal it seems to run fine
The geckodriver.log file is outputting:
1590245018121 mozrunner::runner INFO Running command: "/var/www/mycode/env/bin/firefox" "-marionette" "-headless" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile7raE8H"
/var/www/mycode/env/bin/firefox: 1: /var/www/mycode/env/bin/firefox: which: not found