简体   繁体   English

Selenium Webdriver错误:“无法加载配置文件”

[英]Selenium Webdriver error: “Can't load the profile”

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). 我正在使用Selenium Webdriver(Python绑定),我的脚本适用于Mac(OS X 10.6.8),但不适用于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

I googled around and apparently this error message may have different causes. 我google了一下,显然这个错误信息可能有不同的原因。 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企业版,Service Pack 1,Python 2.7.5,Selenium 2.34,Firefox 23.0)

It seems like Firefox 23 is not yet supported. 似乎还不支持Firefox 23。 Selenium 2.34 added support for Firefox 22, now there is 2.35 released, but there is nothing mentioned about FF23. Selenium 2.34增加了对Firefox 22的支持,现在有2.35发布,但没有提到FF23。

So i suggest you downgrade your firefox to v22 or try the new 2.35 selenium library. 所以我建议你将你的firefox降级到v22或尝试新的2.35 selenium库。

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

How it works on mac? 它在mac上如何工作? - i don't know, are you sure you are running ff23 there? - 我不知道,你确定你在那里运行ff23吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Selenium WebDriver无法加载配置文件 - Selenium WebDriver can't load profile Python3.5 和 FF48 使用 Selenium WebDriver 出现“无法加载配置文件”错误 - "Can't load the profile" error occured with Selenium WebDriver by Python3.5 and FF48 Python:Selenium Firefox Webdriver失败并显示错误:&#39;无法加载配置文件... WARN addons.xpi ...“ - Python: Selenium Firefox Webdriver failing with error: 'Can't load the profile…WARN addons.xpi…" python selenium webdriver问题(selenium.common.exceptions.WebDriverException:消息:“无法加载配置文件。配置文件目录:) - python selenium webdriver issue ( selenium.common.exceptions.WebDriverException: Message: "Can't load the profile. Profile Dir: ) WebDriverException:无法在selenium python脚本中加载配置文件错误 - WebDriverException:can't load profile error in selenium python script Selenium:FirefoxProfile 异常无法加载配置文件 - Selenium: FirefoxProfile exception Can't load the profile 无法在Debian上使用Selenium加载Chrome配置文件 - Can't load Chrome profile with Selenium on Debian 错误-消息:无法加载配置文件。 个人资料目录…使用Firefox进行Selenium Web抓取 - ERROR - Message: Can't load the profile. Profile Dir… Selenium Web Scraping with Firefox Selenium Python Firefox webdriver:无法修改配置文件 - Selenium Python Firefox webdriver : can't modify profile Windows 7下的Selenium无法启动FirefoxDriver:无法加载配置文件 - Selenium under Windows 7 cannot start FirefoxDriver: Can't load profile
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM