WebDriverException:无法在 selenium python 脚本中加载配置文件错误

发布于 2024-12-03 10:13:17 字数 1579 浏览 0 评论 0原文

我在 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版本已经解决了这个问题。

I am using selenium webdriver in python to drive Firefox automaticly, the python script is exported from the selenium IDE add-on in Firefox. But when I run the script it raise error:

        ======================================================================
    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: Can't load the profile. Profile Dir : c:\users\ataosky\appdata\local\temp\tmpwpz

Have anybody encountered this problem? How to solve this? Thanks in advance.

EDIE:selenium 2.5 version has solve this problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谎言 2024-12-10 10:13:17

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

通过升级到最新版本的 selenium (2.13) 修复了该问题。

 sudo pip install selenium --upgrade

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

I had this issue after upgrading to Firefox 8, when running selenium v 2.9.0.

It was fixed by upgrading to the latest version of selenium (2.13).

 sudo pip install selenium --upgrade

(if you're using the Python flavour)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文