Solvedselenium selenium.common.exceptions.WebDriverException: Message: Can't load the profile.

Meta -

OS: Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux
Selenium Version: 2.53.6
Browser: Firefox ESR
Browser Version: 45.3.0(64-bit)
Python Version: 3.4.2

Expected Behavior -

  1. Open the browser
  2. and open the url (https://www.baidu.com)

Actual Behavior -

  1. Open the browser
  2. quit the browser
  3. output the error message to the terminal
(py342) woohoodai@Oycir:~/workspace/superlists$ python functional_test.py 
Traceback (most recent call last):
  File "functional_test.py", line 3, in <module>
    driver = webdriver.Firefox()
  File "/home/woohoodai/.pyenv/versions/py342/lib/python3.4/site-packages/selenium/webdriver/firefox/webdriver.py", line 80, in __init__
    self.binary, timeout)
  File "/home/woohoodai/.pyenv/versions/py342/lib/python3.4/site-packages/selenium/webdriver/firefox/extension_connection.py", line 52, in __init__
    self.binary.launch_browser(self.profile, timeout=timeout)
  File "/home/woohoodai/.pyenv/versions/py342/lib/python3.4/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser
    self._wait_until_connectable(timeout=timeout)
  File "/home/woohoodai/.pyenv/versions/py342/lib/python3.4/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 108, in _wait_until_connectable
    % (self.profile.path))
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: /tmp/tmpmtam_wio If you specified a log_file in the FirefoxBinary constructor, check it for details.

Steps to reproduce -

  1. Run the script
from selenium import webdriver

driver = webdriver.Firefox()

driver.get('https://www.baidu.com')
31 Answers

✔️Accepted Answer

nim4
119

this worked for me:

wget https://github.com/mozilla/geckodriver/releases/download/v0.10.0/geckodriver-v0.10.0-linux64.tar.gz
tar xzvf geckodriver-v0.10.0-linux64.tar.gz
cp geckodriver /usr/bin/
pip install selenium==3.0.0b3

Other Answers:

Every case here appears to be that where everyone is attempting to use Firefox 48 (or greater) with the 'old' FirefoxDriver implementation.

If you are using Firefox 48+ you need to use GeckoDriver:
https://github.com/mozilla/geckodriver

The old FirefoxDriver by the selenium project no longer works due to extension signing and mozilla's refusal to sign it. But even if they did sign it, or one used an 'unbranded' build of firefox, the extension will likely stop working soon due to other changes to Firefox.

Which is why in 3.0 beta releases (they are marked as beta in pypi, why a pip install -U will not pick it up), webdriver.Firefox will default to using Mozilla's geckodriver. Similar to chromedriver / IEDriverServer / EdgeDriver / phantomjs. It is a separate binary on your system that you need to download and put on your system path.

There are quite a few issues with using Firefox 48 and GeckoDriver, that are fixed in FirefoxNightly. I would recommend attempting to see how well your test suite does with FirefoxNightly when trying to switch to GeckoDriver.

To continue to use the old FirefoxDriver on FF 47.0.1 or earlier versions (excluding 47.0 ~ which doesn't work with selenium), you should be setting the DesiredCapability "marionette": False:

driver = webdriver.Firefox(capabilities={"marionette":False})

If you believe you are receiving this error other than a version mismatch with Firefox and the driver implementation issue, then please log a new issue.

I've adjusted the error message in 649b118 but I fear that will not do enough to help users.

I confirm the bug on Ubuntu 16.04, Python 3.5, Selenium2.53.6, Firefox 48 and 49.
Thanks to @BroncaDonk, I get it working :

from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium import webdriver
binary = FirefoxBinary('/path/to/firefox46.0.1') # from https://ftp.mozilla.org/pub/firefox/releases/46.0.1/
d = webdriver.Firefox(firefox_binary=binary)

Same problem with Selenium 2.53.6, Python 3.4.3 (64bit), Windows7 (64bit), and Firefox 47.0 or 48.0.2.

Rolling back Firefox to 46.0.1 functions as a workaround for me.

Emptying C:\Users\myprofile\AppData\Local\Temp did not fix.
Issuing "pip install -U selenium" did not fix

More Issues: