根据 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/