python - Selenium:FirefoxProfile 异常无法加载配置文件

标签 python firefox selenium selenium-webdriver webdriver

根据 this previous question我将 Selenium 更新到 2.0.1 版 但是现在我有另一个错误,即使配置文件存在于 /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

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

最佳答案

更新:

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

关于python - Selenium:FirefoxProfile 异常无法加载配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6682009/

相关文章:

python - 如何使用 os.environ 在 python 中设置时区

Python - 将美元值转换为 float

javascript - 在 JavaScript 中打开新的浏览器窗口而不使其处于事件状态

html - 容器不展开

python - django-registration 简单的后端设置

python - os.environ 没有在 Jupyter notebook 中显示所有环境变量

html - CSS 下载字体在 Firefox ("Content Blocked Source"中被阻止)

Python 2.7 Selenium 网站上没有这样的元素

linux - Selenium:在 Linux 服务器上截图时得到一个空白的白色图像(使用 Xvfb)

java - TestNG 测试使用一个测试的参数而不是自己的参数