“Exception: No extension found at None” when trying on use Selenium Firefox WebDriver on a Mac
Question
Any ideas?
In [1]: from selenium.firefox.webdriver import WebDriver
In [2]: d=WebDriver()
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
/usr/local/selenium-read-only/<ipython console> in <module>()
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/selenium-2.0_dev-py2.6.egg/selenium/firefox/webdriver.pyc in __init__(self, profile, timeout)
48 profile = FirefoxProfile(name=profile)
49 if not profile:
---> 50 profile = FirefoxProfile()
51 self.browser.launch_browser(profile)
52 RemoteWebDriver.__init__(self,
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/selenium-2.0_dev-py2.6.egg/selenium/firefox/firefox_profile.pyc in __init__(self, name, port, template_profile, extension_path)
72
73 if name == ANONYMOUS_PROFILE_NAME:
---> 74 self._create_anonymous_profile(template_profile)
75 self._refresh_ini()
76 else:
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/selenium-2.0_dev-py2.6.egg/selenium/firefox/firefox_profile.pyc in _create_anonymous_profile(self, template_profile)
82 self._copy_profile_source(template_profile)
83 self._update_user_preference()
---> 84 self.add_extension(extension_zip_path=self.extension_path)
85 self._launch_in_silent()
86
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/selenium-2.0_dev-py2.6.egg/selenium/firefox/firefox_profile.pyc in add_extension(self, force_create, extension_zip_path)
152 not os.path.exists(extension_source_path)):
153 raise Exception(
--> 154 "No extension found at %s" % extension_source_path)
155
156 logging.debug("extension_source_path : %s" % extension_source_path)
Exception: No extension found at None
Solution 2
OK, I solved it by discovering that the virtualenv was I installed via macports was "missing",
sudo ln -s `which virtualenv-2.6` /opt/local/bin/virtualenv
then running rake firefox
and finally rake firefox_xpi
...
OTHER TIPS
Okay, I've gotten past this Exception by manually creating the webdriver-extension.zip
file and copying it to the selenium/firefox
folder in my site-packages directory.
Everything that follows assumes you have gotten a copy of the source code from http://selenium.googlecode.com/svn/trunk/ (using subversion/svn)
If you have Ruby installed you might be able to run rake firefox
(that's Ruby make), which is the way you are supposed to build the zip file. Since I don't have ruby installed, I just looked at the /Rakefile
and figured out what was supposed to be in the zip.
Basically you just need to add everything in the /firefox/src/extension/
folder. On windows I added the /firefox/prebuilt/Win32/Release/webdriver-firefox.dll
to it as well, but I'm not sure I needed to. (On linux you may need to add the appropriate .so file).
what is the following code doing?
from selenium.firefox.webdriver import WebDriver
d = WebDriver()
a proper webdriver import and firefox instantiation looks like this:
from selenium import webdriver
d = webdriver.Firefox()