I have been wracking my brain over this. I'm getting the error:
System geckodriver unexpectedly exited. Status code: -11.
I am using a Linux server that is a shared hosting web server. I have everything set up in a virtual environment.
- Linux Server - CentOS, Release: 7.4.1708
- Selenium version 3.14141.0
- geckodriver version 0.23.0
- Firefox 60.3.0
- Python 3.6.2 and cannot use a newer version
Python, Selenium and Geckodriver reside on a virtual environment on a Linux web server. Firefox resides outside of the virtual environment
export PATH=$PATH:/path/to/geckodriver to my terminal to have geckodriver be used in the PATH environment variable.
Below is my code:
#!/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/python # -*- coding: UTF-8 -*- import cgitb import cgi from selenium import webdriver from selenium.webdriver import FirefoxOptions cgitb.enable() print ("Content-Type: text/html; charset=utf-8\n\n") path = r'/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/geckodriver' binary = FirefoxBinary(r'/usr/lib64/firefox') opts = FirefoxOptions() opts.add_argument("--headless") browser = webdriver.Firefox(firefox_options=opts, firefox_binary=binary, executable_path=path) rowser.get("http://google.com/") print ("Headless Firefox Initialized") browser.quit() Here is my traceback error:
Traceback (most recent call last): File "selen.py", line 20, in <module> browser = webdriver.Firefox(firefox_options=opts, executable_path=path) File "/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 164, in __init__ self.service.start() File "/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 98, in start self.assert_process_still_running() File "/home/DIRECTORY/DIRECTORY/DIRECTORY/venv/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running % (self.path, return_code) selenium.common.exceptions.WebDriverException: Message: Service /home/DIRECTORY/DIRECTORY/DIRECTORY/venv/bin/geckodriver unexpectedly exited. Status code was: -11 Why am I getting this error and how do I fix it?