本文介绍了Selenium:FirefoxProfile 异常无法加载配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 上一个问题,我将 Selenium 更新到了 2.0 版.1但是现在我有另一个错误,即使配置文件存在于 /tmp/webdriver-py-profilecopy 下:

文件/home/sultan/Repository/Django/monitor/app/request.py",第 236 行,在执行中浏览器 = Firefox(配置文件)文件/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py",第 46 行,在 __init__self.binary,超时),文件/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/extension_connection.py",第46行,在__init__self.binary.launch_browser(self.profile)文件/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py",第44行,在launch_browserself._wait_until_connectable()文件/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py",第87行,_wait_until_connectableraise WebDriverException("无法加载配置文件.配置文件目录:%s" % self.profile.path)selenium.common.exceptions.WebDriverException:无法加载配置文件.配置文件目录:/tmp/webdriver-py-profilecopy

怎么了?我该如何解决这个问题?

解决方案

更新:

Selenium 团队已在最新版本中修复.对于几乎所有环境,修复是:

pip install -U selenium

不清楚它是在哪个版本中修复的(显然是 r13122),但肯定会在 2.26.0(更新时的当前版本)中修复.

此错误表示_wait_until_connectable 超时,因为由于某种原因,代码无法连接到已加载到firefox 中的webdriver 扩展.

我刚刚向 selenium 报告了一个错误,因为我正在尝试使用代理,并且配置文件中的 4 个已配置更改中只有 2 个已被 firefox 接受,因此未配置代理与分机交谈.不知道为什么会这样...

https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/2061

Per this previous question I updated Selenium to version 2.0.1But now I have another error, even when the profile files exist under /tmp/webdriver-py-profilecopy:

  File "/home/sultan/Repository/Django/monitor/app/request.py", line 236, in perform
    browser = Firefox(profile)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 46, in __init__
    self.binary, timeout),
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/extension_connection.py", line 46, in __init__
    self.binary.launch_browser(self.profile)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 44, in launch_browser
    self._wait_until_connectable()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 87, in _wait_until_connectable
    raise WebDriverException("Can't load the profile. Profile Dir : %s" % self.profile.path)
selenium.common.exceptions.WebDriverException: Can't load the profile. Profile Dir : /tmp/webdriver-py-profilecopy

What is wrong? How can I resolve this issue?

解决方案

Update:

Selenium team fixed in latest version. For almost all environments the fix is:

Unclear at which version it was fixed (apparently r13122), but certainly by 2.26.0 (current at time of update) it is fixed.


This error means that _wait_until_connectable is timing out, because for some reason, the code cannot connect to the webdriver extension that has been loaded into the firefox.

I have just reported an error to selenium where I am getting this error because I'm trying to use a proxy and only 2 of the 4 configured changes in the profile have been accepted by firefox, so the proxy isn't configured to talk to the extension. Not sure why this is happening...

https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/2061

这篇关于Selenium:FirefoxProfile 异常无法加载配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 02:40