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/17288577/

相关文章:

python - 如何在 Python 的 mixin 中调用封闭类的 super?

python - 从另一个数据框中替换列的值

Python 和 OpenCV - 无法编写可读的 avi 视频文件

html - 如何使特定网站与其他浏览器兼容?

asp.net - 页面加载在 Firefox 上触发两次

selenium - 具有不同 URL 的 Specflow 场景大纲

python - Python 中的 CSV 在 Windows 上添加额外的回车符

javascript - 纯Javascript : onClick toggle rows/image: Firefox/Chrome - works: IE - does not work

java - 如果元素未存储在数组中,如何从下拉列表中单击选项

java - 如何处理 - 在缓存中找不到元素 - 也许页面自从在 Selenium WebDriver Java 测试中查找以来已经发生了变化