For my research, I did some source code modifications in firefox and build it myself. In order to automate testing, I opted to use Selenium but unfortunately, my newly built Firefox seem to not support Selenium.
I did the following:
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary("/path/to/firefox/binary")
d = webdriver.Firefox(firefox_binary=binary)
d.get("http://www.google.de")
The Firefox does open and is responsive (I can enter a website in the search bar). But after a while, the python script crashes with the following error message:
Traceback (most recent call last):
File "firefox.py", line 7, in <module>
d = webdriver.Firefox(firefox_binary=binary)
File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/firefox/webdriver.py", line 59, in __init__
self.binary, timeout),
File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in __init__
self.binary.launch_browser(self.profile)
File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 66, in launch_browser
self._wait_until_connectable()
File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 109, in _wait_until_connectable
raise WebDriverException("Can't load the profile. Profile "
selenium.common.exceptions.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 did google that error message and most solutions suggested, that I should Update Selenium since it does not support the Firefox version used. Unfortunately, I installed the newest version of selenium (2.44.0) and I even used an older version of Firefox (version 33) to rule out that point.
I also made sure that my code modifications are not the reason for this to crash by building a clean, unmodified firefox. Selenium doesn't work with this firefox either.
If I don't specify a firefox binary and let Selenium use the installed Firefox, everything works fine. So my guess is, that something is wrong with the firefox build, which I did exactly as mentioned in the online documentation (e.g. ./mach build).
Has anyone an idea, what my mistake might be? Any help is greatly appreciated!
Some setup information:
Firefox 33
Selenium 2.44.0
Python 3.4 (also tried 2.7, doesn't work either)
Firefox build with Ubuntu 14.04