Selenium Webdriver错误:“无法加载配置文件" [英] Selenium Webdriver error: "Can't load the profile"

查看:76
本文介绍了Selenium Webdriver错误:“无法加载配置文件"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Selenium Webdriver(Python绑定),并且我的脚本可在Mac(OS X 10.6.8)上运行,但不能在PC(Windows 7 Enterprise)上运行.这是我得到的错误:

I'm using Selenium Webdriver (Python bindings) and my script works on Mac (OS X 10.6.8), but not on PC (Windows 7 Enterprise). Here's the error I get:

C:\Python27>python myscript.py
Traceback (most recent call last):
  File "myscript.py", line 303, in <module>
    myfunction(arg1)
  File "myscript.py", line 87, in myfunction
    browser = webdriver.Firefox(firefox_profile = fp)
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py",
line 61, in __init__
    self.binary, timeout),
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\extension_conne
ction.py", line 47, in __init__
    self.binary.launch_browser(self.profile)
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.
py", line 61, in launch_browser
    self._wait_until_connectable()
  File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.
py", line 105, in _wait_until_connectable
    self.profile.path, self._get_firefox_output()))
selenium.common.exceptions.WebDriverException: Message: "Can't load the profile.
 Profile Dir: c:\\users\\marzagao.1\\appdata\\local\\temp\\tmpnn0nhk Firefox out
put: "

这是我脚本的相关部分(我正在遍历不同的下载文件夹):

Here's the relevant part of my script (I'm iterating over different download folders):

for download_folder in list_of_download_folders:

    fp = webdriver.FirefoxProfile()
    fp.set_preference("browser.download.folderList", 2)
    fp.set_preference("browser.download.manager.showWhenStarting", False)
    fp.set_preference("browser.download.dir", download_folder)
    fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "text/plain")
    browser = webdriver.Firefox(firefox_profile = fp)

    # gets URL, download files

我在Google周围搜索,显然此错误消息可能有不同的原因.我在此处尝试了此解决方案,但没有成功(即使错误消息类似,我也认为这不适用于我的情况).有什么想法吗?

I googled around and apparently this error message may have different causes. I tried this solution here but it didn't work (I guess it's not applicable to my case, even though the error message is similar). Any thoughts?

(Windows 7 Enterprise,Service Pack 1,Python 2.7.5,Selenium 2.34,Firefox 23.0)

(Windows 7 Enterprise, Service Pack 1, Python 2.7.5, Selenium 2.34, Firefox 23.0)

推荐答案

似乎尚未支持Firefox 23. Selenium 2.34增加了对Firefox 22的支持,现在发布了2.35,但没有提及FF23.

It seems like Firefox 23 is not yet supported. Selenium 2.34 added support for Firefox 22, now there is 2.35 released, but there is nothing mentioned about FF23.

因此,我建议您将Firefox降级为v22或尝试使用新的2.35硒库.

So i suggest you downgrade your firefox to v22 or try the new 2.35 selenium library.

https://github.com/SeleniumHQ/selenium/blob/master/py/CHANGES

它在Mac上如何工作? -我不知道,确定要在其中运行ff23吗?

How it works on mac? - i don't know, are you sure you are running ff23 there?

这篇关于Selenium Webdriver错误:“无法加载配置文件"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆