一千萬個為什麽

搜索

嘗試在Mac上使用Selenium Firefox WebDriver時,“例外:在無”中找不到擴展名

有任何想法嗎?

In [1]: from selenium.firefox.webdriver import WebDriver

In [2]: d=WebDriver()
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)

/usr/local/selenium-read-only/ in ()

/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

最佳答案

好吧,我通過發現我通過macports安裝的virtualenv“缺失”解決了這個問題,

sudo ln -s `which virtualenv-2.6` /opt/local/bin/virtualenv 

然後運行 rake firefox ,最後 rake firefox_xpi ...

轉載註明原文: 嘗試在Mac上使用Selenium Firefox WebDriver時,“例外:在無”中找不到擴展名