0

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:

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
Nelo
  • 145
  • 10

1 Answers1

0

Since I could run the script from the terminal, I eventually realized the he problem was gunicorn. I had to add Environment="PATH=/usr/bin" to the gunicorn service script running on the server.

Nelo
  • 145
  • 10