【问题标题】:WebDriverException:can't load profile error in selenium python scriptWebDriverException:无法在 selenium python 脚本中加载配置文件错误
【发布时间】:2011-11-11 19:42:44
【问题描述】:

我在 python 中使用 selenium webdriver 来自动驱动 Firefox,python 脚本是从 Firefox 中的 selenium IDE 插件导出的。但是当我运行脚本时,它会引发错误:

        ======================================================================
    ERROR: test_selenium (__main__.SeleniumTest)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "selenium_test.py", line 8, in setUp
        self.driver = webdriver.Firefox()
      File "C:\Python26\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 46, in __init__

        self.binary, timeout),
      File "C:\Python26\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 46,
    in __init__
        self.binary.launch_browser(self.profile)
      File "C:\Python26\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 44, in lau
    nch_browser
        self._wait_until_connectable()
      File "C:\Python26\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 87, in _wa
    it_until_connectable
        raise WebDriverException("Can't load the profile. Profile Dir : %s" % self.profile.path)
    WebDriverException: Can't load the profile. Profile Dir : c:\users\ataosky\appdata\local\temp\tmpwpz
    zrv

    ----------------------------------------------------------------------
    Ran 1 test in 67.876s

    FAILED (errors=1)

WebDriverException:无法加载配置文件。配置文件目录:c:\users\ataosky\appdata\local\temp\tmpwpz

有人遇到过这个问题吗?如何解决这个问题?提前致谢。

EDIE:selenium 2.5 版本已经解决了这个问题。

【问题讨论】:

  • 我们能看到代码吗?我在 C# 中遇到过类似的问题,但如果没有看到您的代码,我什么也不能告诉您...
  • +1 - 与 selenium 2.9.0 相同的问题。怀疑可能与最近的 Firefox 8 升级有关。

标签: python unit-testing selenium webdriver web-testing


【解决方案1】:

升级到 Firefox 8 后,我在运行 selenium v​​ 2.9.0 时遇到了这个问题。

已通过升级到最新版本的 selenium (2.13) 修复。

 sudo pip install selenium --upgrade

(如果您使用的是 Python 风格)

【讨论】:

  • 我有同样的问题,但是由于 selenium 2.9+ 中的错误,我无法升级到 Firefox 8。我必须降级到 Firefox 7,我遇到的问题是在夜间测试运行期间自动更新,并且在升级之前我有我的 Firefox 首选项设置提示
  • 我也遇到了这个问题。自上次运行 v2.2 的 selenium 以来升级了 FF。我已将其升级到 2.24,并将 firefox 作为默认配置文件执行且没有错误。
猜你喜欢
  • 2013-08-12
  • 2016-06-25
  • 1970-01-01
  • 2014-11-25
  • 2022-06-29
  • 1970-01-01
  • 2016-03-23
  • 2017-01-19
相关资源
最近更新 更多