Python:Selenium Firefox Web驱动程序失败,错误为&x27;Can';t加载配置文件…WARN addons.xpi…”;

Python:Selenium Firefox Web驱动程序失败,错误为&x27;Can';t加载配置文件…WARN addons.xpi…”;,python,firefox,selenium,xpi,Python,Firefox,Selenium,Xpi,我试图通过Selenium运行以下Python代码来创建Firefox Webdriver窗口: from selenium import webdriver driver = webdriver.Firefox() driver.get("http://www.google.com") 虽然这段代码在几周前运行良好,但现在它产生了以下不祥信息: Traceback (most recent call last): File "test.py", line 2, in <modul

我试图通过Selenium运行以下Python代码来创建Firefox Webdriver窗口:

from selenium import webdriver
driver = webdriver.Firefox()
driver.get("http://www.google.com")
虽然这段代码在几周前运行良好,但现在它产生了以下不祥信息:

 Traceback (most recent call last):
  File "test.py", line 2, in <module>
    driver = webdriver.Firefox()
  File "c:\python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 60, in __init__
    self.binary, timeout),
  File "c:\python27\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 47, in __init__
    self.binary.launch_browser(self.profile)
  File "c:\python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 61, in launch_browser
    self._wait_until_connectable()
  File "c:\python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 105, in _wait_until_connectable
    self.profile.path, self._get_firefox_output()))
selenium.common.exceptions.WebDriverException: Message: 'Can\'t load the profile. Profile Dir: c:\\users\\douglas\\appdata\\local\\temp\\tmpuf4ipq Firefox output: *** LOG addons.xpi: startup\r\n*** WARN addons.xpi: Ignoring missing add-on in C:\\Program Files\\CheckPoint\\ZAForceField\\WOW64\\TrustChecker\r\n*** WARN addons.xpi: Ignoring missing add-on in C:\\ProgramData\\Norton\\{78CA3BF0-9C3B-40e1-B46D-38C877EF059A}\\NSM_2.9.5.20\\coFFFw\r\n*** LOG addons.xpi: Skipping unavailable install location app-system-local\r\n*** LOG addons.xpi: Skipping unavailable install location app-system-share\r\n*** LOG addons.xpi: checkForChanges\r\n*** LOG addons.xpi: No changes found\r\n*** Blocklist::_loadBlocklistFromFile: blocklist is disabled\r\n************************************************************\r\n* Call to xpconnect wrapped JSObject produced this error:  *\r\n[Exception... "\'[JavaScript Error: "this._defaultEngine is null" {file: "resource://gre/components/nsSearchService.js" line: 3527}]\' when calling method: [nsIBrowserSearchService::currentEngine]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: chrome://browser/content/search/search.xml :: get_currentEngine :: line 130"  data: yes]\r\n************************************************************\r\n************************************************************\r\n* Call to xpconnect wrapped JSObject produced this error:  *\r\n[Exception... "\'[JavaScript Error: "this._defaultEngine is null" {file: "resource://gre/components/nsSearchService.js" line: 3527}]\' when calling method: [nsIBrowserSearchService::currentEngine]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: chrome://browser/content/search/search.xml :: get_currentEngine :: line 130"  data: yes]\r\n************************************************************\r\n************************************************************\r\n* Call to xpconnect wrapped JSObject produced this error:  *\r\n[Exception... "\'[JavaScript Error: "this._defaultEngine is null" {file: "resource://gre/components/nsSearchService.js" line: 3527}]\' when calling method: [nsIBrowserSearchService::currentEngine]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: resource://app/components/nsBrowserGlue.js :: <TOP_LEVEL> :: line 354"  data: yes]\r\n************************************************************\r\n************************************************************\r\n* Call to xpconnect wrapped JSObject produced this error:  *\r\n[Exception... "\'[JavaScript Error: "this._defaultEngine is null" {file: "resource://gre/components/nsSearchService.js" line: 3527}]\' when calling method: [nsIBrowserSearchService::currentEngine]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: resource://app/components/nsBrowserGlue.js :: <TOP_LEVEL> :: line 354"  data: yes]\r\n************************************************************\r\n'
回溯(最近一次呼叫最后一次):
文件“test.py”,第2行,在
driver=webdriver.Firefox()
文件“c:\python27\lib\site packages\selenium\webdriver\firefox\webdriver.py”,第60行,在\uuu init中__
self.binary,超时),
文件“c:\python27\lib\site packages\selenium\webdriver\firefox\extension\u connection.py”,第47行,在\uuu init中__
self.binary.launch_浏览器(self.profile)
文件“c:\python27\lib\site packages\selenium\webdriver\firefox\firefox\u binary.py”,第61行,在启动浏览器中
self.\u等待\u直到\u可连接()
文件“c:\python27\lib\site packages\selenium\webdriver\firefox\firefox\u binary.py”,第105行,在可连接之前等待
self.profile.path,self.\u get\u firefox\u output())
selenium.common.exceptions.WebDriverException:消息:“无法加载配置文件。”。Profile Dir:c:\\users\\douglas\\appdata\\local\\temp\\tmpuf4ipq Firefox输出:**LOG addons.xpi:startup\r\n***WARN addons.xpi:忽略c:\\Program Files\\CheckPoint\\ZAForceField\\WOW64\\TrustChecker\n***WARN addons.xpi:忽略c:\\programmadata\\Norton\\{78CA3BF0-9C3B-40e1-B46D-38C877EF059A}\\NSM_2.9.5.20\\coFFFw\r\n***LOG addons.xpi:跳过不可用的安装位置app system local\r\n***LOG addons.xpi:跳过不可用的安装位置app system share\r\n***LOG addons.xpi:检查更改\r\n***LOG addons.xpi:未找到更改\r\n***阻止列表::\u loadBlocklistFromFile:阻止列表为已禁用\r\n******************************************************************************\r\n*对xpconnect包装的JSObject的调用产生了以下错误:“\r\n[异常…””[JavaScript错误:“this.\u defaultEngine为null”{file:”resource://gre/components/nsSearchService.js“调用方法:[nsIBrowserSearchService::currentEngine]时的行:3527}]\”nsresult:“0x80570021(NS\u错误\u XPC\u JAVASCRIPT\u错误\u和\u详细信息)”位置:“JS帧::chrome://browser/content/search/search.xml ::get_currentEngine::第130行“数据:是]\r\n***************************************************************************************************\r\n***调用xpconnect包装的JSObject产生此错误:“\r\n*********************************************************************************************************************************************************************\r\n*调用xpconnect包装的JSObject生成此错误:“\r\r\n[默认JavaScript引擎为空文件]resource://gre/components/nsSearchService.js“行:3527}]\“调用方法时:[nsIBrowserSearchService::currentEngine]”nsresult:“0x80570021(NS\u错误\u XPC\u JAVASCRIPT\u错误及详细信息)”位置:“JS帧::chrome://browser/content/search/search.xml ::get_currentEngine::第130行“数据:是]\r\n***************************************************************************************************\r\n***调用xpconnect包装的JSObject产生此错误:“\r\n*********************************************************************************************************************************************************************\r\n*调用xpconnect包装的JSObject生成此错误:“\r\r\n[默认JavaScript引擎为空文件]resource://gre/components/nsSearchService.js“行:3527}]\“调用方法时:[nsIBrowserSearchService::currentEngine]”nsresult:“0x80570021(NS\u错误\u XPC\u JAVASCRIPT\u错误及详细信息)”位置:“JS帧::resource://app/components/nsBrowserGlue.js 第354行“数据:是]\r\n***************************************************************************************************\r\n***调用xpconnect包装的JSObject产生此错误:“\r\n*********************************************************************************************************************************************************************\r\n*调用xpconnect包装的JSObject生成此错误:“\r\r\n[默认JavaScript引擎为空文件]resource://gre/components/nsSearchService.js“行:3527}]\“调用方法时:[nsIBrowserSearchService::currentEngine]”nsresult:“0x80570021(NS\u错误\u XPC\u JAVASCRIPT\u错误及详细信息)”位置:“JS帧::resource://app/components/nsBrowserGlue.js ::第354行“数据:是]\r\n******************************************************************************************************\r\n”
有人知道这意味着什么,或者我能做些什么来纠正错误并让代码按预期运行吗?我通过谷歌搜索找到了相关的错误消息,但没有任何东西能让我解决这个问题

值得一提的是,通过将上面的第二行更改为
driver=Webdriver.Chrome()
,我可以毫无问题地打开一个Chrome Webdriver


我正在Windows8机器上使用Python 2.7、Selenium 2.35.0(我刚刚运行了“pip安装Selenium——升级”)和Firefox 26.0。非常感谢其他人提供的任何提示或建议。

Selenium 2.35与Firefox 26不兼容。如上所述,Selenium 2.39中添加了FF 26支持。您需要更新到2.39。请尝试使用
pip安装-U selenium

不确定它在Windows上是否也能正常工作,但对我来说,Firefox 26和selenium 2.37.0的组合可以正常工作。

我在Win8.1 FF28和python3.4/selenium 2.41中也存在此问题。但在我把FF降到24岁后,它成功了!我还在Win8.1/FF27/Python3.4/Selenium 2.41中进行了测试,它也起到了作用

我刚刚在FF36和selenium 2.44.0中遇到了同样的问题。重新安装FF 32.0修复了它。

我在Kubuntu 14.04桌面上遇到了同样的问题,我删除了Firefox 47.XX,重新安装了Firefox 45.XX,问题得到了解决

下载firefox debian软件包

  • apt获取清除firefox
  • dpkg-i firefox-xxxxxxxxx.deb

我运行了
pip安装-U selenium
,它显示selenium已升级,但我仍然收到相同的错误消息。任何其他建议都是最受欢迎的,因为您发布的跟踪不是来自您发布的代码示例。您的机器上是否安装了多个Python?你确定你仍然会犯同样的错误,而不是类似的错误吗?非常感谢,@Silas Ray;我刚刚更新了上面发布的代码生成的错误消息。我想我只有2.7分了