WebDriverException:无法在 selenium python 脚本中加载配置文件错误
我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
升级到 Firefox 8 后,我在运行 selenium v 2.9.0 时遇到了这个问题。
通过升级到最新版本的 selenium (2.13) 修复了该问题。
(如果您使用的是 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).
(if you're using the Python flavour)