Selenium on Elementary OS not working with Firefox
<p>I've got a problem with Selenium on my system. For some reason, it wont launch a Firefox browser window. </p>

<p>Here are the steps that I have gone though.</p>

<ul>
<li>Downloaded Selenium via pip</li>
<li>Downloaded the Marionette (gecko) driver</li>
<li>Added the directory of the downloaded file to my PATH.</li>
</ul>

<p>I am still receiving the below error though.</p>

<pre><code>/usr/bin/python2.7 /home/keva161/PycharmProjects/selenium_test.py
Traceback (most recent call last):
  File "/home/keva161/PycharmProjects/selenium_test.py", line 21, in &lt;module&gt;
    driver = webdriver.Firefox(capabilities=caps)
  File "/home/keva161/.local/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 135, in __init__
    self.service.start()
  File "/home/keva161/.local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 71, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 

Exception AttributeError: "'Service' object has no attribute 'process'" in &lt;bound method Service.__del__ of &lt;selenium.webdriver.firefox.service.Service object at 0x7f9bcde911d0&gt;&gt; ignored
</code></pre>

<p>The script the I am trying to run is:</p>

<pre><code>from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

caps = DesiredCapabilities.FIREFOX

# Tell the Python bindings to use Marionette.
# This will not be necessary in the future,
# when Selenium will auto-detect what remote end
# it is talking to.
caps["marionette"] = True

# Path to Firefox DevEdition or Nightly.
# Firefox 47 (stable) is currently not supported,
# and may give you a suboptimal experience.
#
# On Mac OS you must point to the binary executable
# inside the application package, such as
# /Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin
caps["binary"] = "/usr/bin/firefox"

driver = webdriver.Firefox(capabilities=caps)

driver = webdriver.Firefox()
driver.get('http://saucelabs.com/test/guinea-pig')
driver.quit()
</code></pre>

<p>I am using the latest version of Firefox.</p>

<p>PyCharm ignores your PYTHONPATH, instead it builds it based on your project configuration(s), so you need to teach it where it can find <code>gecko</code>. You can do that in either of these 2 ways:</p>

<ul>
<li>configure your interpreter path to include the gecko's dir, see <a href="https://www.jetbrains.com/help/pycharm/2016.1/project-interpreters.html#paths" rel="nofollow">Interpreter paths</a></li>
<li>add the gecko's dir as content or source root (see <a href="https://www.jetbrains.com/help/pycharm/2016.1/content-root.html" rel="nofollow">Content Root</a>) and select the respective check box (<code>Add content roots to PYTHONPATH</code> or <code>Add source roots to PYTHONPATH</code>) in the project's run configuration, see <a href="https://www.jetbrains.com/help/pycharm/2016.1/run-debug-configuration-python.html" rel="nofollow">Run/Debug Configuration: Python</a>.</li>
</ul>

python selenium firefox pycharm elementary