简体   繁体   English

Python:Selenium Firefox Webdriver失败并显示错误:'无法加载配置文件... WARN addons.xpi ...“

[英]Python: Selenium Firefox Webdriver failing with error: 'Can't load the profile…WARN addons.xpi…"

I am trying to run the following Python code to create a Firefox Webdriver window via Selenium: 我正在尝试运行以下Python代码以通过Selenium创建Firefox Webdriver窗口:

from selenium import webdriver
driver = webdriver.Firefox()
driver.get("http://www.google.com")

While this code worked fine a few weeks ago, it now produces the following foreboding message: 虽然这段代码几周前工作正常,但它现在会产生以下预感信息:

 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'

Does anyone know what this means, or what I can do to remedy the error and get the code to run as expected? 有谁知道这意味着什么,或者我可以做些什么来弥补错误并让代码按预期运行? I've found related error messages through Google searches, but nothing that has allowed me to resolve the issue. 我通过Google搜索找到了相关的错误消息,但没有任何消息可以让我解决问题。

For what it's worth, I can open a Chrome Webdriver without issue by changing the second line of the above to driver = webdriver.Chrome() . 对于它的价值,我可以通过将上面的第二行更改为driver = webdriver.Chrome()来打开Chrome Webdriver而不会出现问题。

I'm using Python 2.7, Selenium 2.35.0 (I just ran "pip install selenium --upgrade) and Firefox 26.0 on a Windows 8 machine. Any tips or advice others can offer are most appreciated. 我正在使用Python 2.7,Selenium 2.35.0(我刚刚在Windows 8机器上运行“pip install selenium --upgrade”和Firefox 26.0。非常感谢其他人可以提供的任何提示或建议。

Selenium 2.35 is not compatible with Firefox 26. As the release notes say, FF 26 support was added in Selenium 2.39. Selenium 2.35与Firefox 26不兼容。正如发行说明所述 ,在Selenium 2.39中添加了FF 26支持。 You need to update to 2.39. 您需要更新到2.39。 Try pip install -U selenium instead. 试试pip install -U selenium

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

I also have this issue in Win8.1 FF28 and python3.4/selenium 2.41. 我在Win8.1 FF28和python3.4 / selenium 2.41中也有这个问题。 But after I degraded FF to 24, it worked! 但是在我将FF降级到24之后,它起作用了! And I also tested in Win8.1/FF27/Python3.4/Selenium 2.41, it worked too. 我也在Win8.1 / FF27 / Python3.4 / Selenium 2.41中进行了测试,它也有效。

I just ran into the same thing with FF36 and selenium 2.44.0. 我刚刚用FF36和selenium 2.44.0遇到了同样的事情。 Re-installing FF 32.0 fixed it. 重新安装FF 32.0修复它。

I've experienced the same problem on my Kubuntu 14.04 desktop, I removed the Firefox 47.XX and re-installed Firefox 45.XX and the problem resolved. 我在Kubuntu 14.04桌面上遇到了同样的问题,我删除了Firefox 47.XX并重新安装了Firefox 45.XX并解决了问题。

Download firefox debian package 下载firefox debian包

  • apt-get purge firefox apt-get purge firefox
  • dpkg -i firefox-XXXXXXXXXX.deb dpkg -i firefox-XXXXXXXXXX.deb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Selenium Webdriver错误:“无法加载配置文件” - Selenium Webdriver error: “Can't load the profile” Selenium Python Firefox webdriver:无法修改配置文件 - Selenium Python Firefox webdriver : can't modify profile Python3.5 和 FF48 使用 Selenium WebDriver 出现“无法加载配置文件”错误 - "Can't load the profile" error occured with Selenium WebDriver by Python3.5 and FF48 Selenium WebDriver无法加载配置文件 - Selenium WebDriver can't load profile 错误-消息:无法加载配置文件。 个人资料目录…使用Firefox进行Selenium Web抓取 - ERROR - Message: Can't load the profile. Profile Dir… Selenium Web Scraping with Firefox 在python selenium中加载Firefox的配置文件 - Load a profile of Firefox in python selenium Python Firefox Selenium 负载配置文件 - Python Firefox Selenium Load Profile python selenium webdriver问题(selenium.common.exceptions.WebDriverException:消息:“无法加载配置文件。配置文件目录:) - python selenium webdriver issue ( selenium.common.exceptions.WebDriverException: Message: "Can't load the profile. Profile Dir: ) WebDriverException:无法在selenium python脚本中加载配置文件错误 - WebDriverException:can't load profile error in selenium python script 在python中使用默认的firefox配置文件和selenium webdriver - Using the default firefox profile with selenium webdriver in python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM