Never Nor Never Nor - 10 days ago 6
Python Question

WebDriverException: Message: Can't load the profile. At a loss as to what is happening

I've been using webdriver.Firefox() for years now, today I started another project and

browser = webdriver.Firefox()
is returning

WebDriverException: Message: Can't load the profile. Profile Dir: %s If you specified a log_file in the FirefoxBinary constructor, check it for details.


I have tried adding
C:\Program Files (x86)\Mozilla Firefox\firefox.exe
to my PATH. I have tried
pip install -U selenium
. I've tried

binary = FirefoxBinary('C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe')
browser = webdriver.Firefox(firefox_binary=binary)

profile = FirefoxProfile("C:\Users\Me\AppData\Roaming\Mozilla\Firefox\Profiles\8u2w2ge1.Me")
browser = webdriver.Firefox(profile)


I have added the addon checkcompatibility to my firefox addons. Nothing, nothing is working, same error, Python 2.7.11, Windows 10 x64

This is the general traceback I am getting.

Traceback (most recent call last):
File "<pyshell#14>", line 1, in <module>
browser = webdriver.Firefox(firefox_binary=binary)
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 80, in __init__
self.binary, timeout)
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 52, in __init__
self.binary.launch_browser(self.profile, timeout=timeout)
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 68, in launch_browser
self._wait_until_connectable(timeout=timeout)
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 108, in _wait_until_connectable
% (self.profile.path))
WebDriverException: Message: Can't load the profile. Profile Dir: c:\users\me\appdata\local\temp\tmpwvgny8 If you specified a log_file in the FirefoxBinary constructor, check it for details.


Anyone know why it is having issues creating this profile in the temp directory? Some new way to force it to profiles that exist, because my old method is not working.

Answer

I've actually found a work around for this, it isn't perfect and I actually use chrome through chromedriver, since it is a bit more stable, but to use firefox you might want to download a geckodriver and include it in your system path or path to it in your setup of the browser, https://github.com/mozilla/geckodriver/releases, seems to be where they keep releases, chrome has a chromedriver that functions and is used in much the same way. I am not sure why we need these new drivers to use selenium in windows, but such is life, hopes this saves someone else some work.

Comments