在python 3.2中使用Selenium 2.44和FF32无法加载配置文件

时间:2014-11-14 07:48:55

标签: python selenium cygwin

使用Python 3.2(在Cygwin中)和Selenium 2.44和FF32(以及FF33),Win8.1 64位代码

browser = webdriver.Firefox()

抛出错误

File "/usr/lib/python3.2/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 105, in _wait_until_connectable  
self.kill()  
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: %s If you specified a log_file in the FirefoxBinary constructor, check it for details.

我做错了吗?我搜索谷歌,发现类似的问题,但所有专家建议将硒升级到最新,我已经这样做了。我尝试用FF 24,28检查,但无法解决。 Pl帮助我

1 个答案:

答案 0 :(得分:0)

看起来selenium的配置文件路径处理在Cygwin

中存在问题

临时黑客攻击

在cygwin_dir \ lib \ python3.2 \ site-packages \ selenium \ webdriver \ firefox \ firefox_binary.py中,按以下行替换路径

def _start_from_profile_path(self, path):
          self._firefox_env["XRE_PROFILE_PATH"] = Popen(["cygpath", "-w",  path], stdout=PIPE).stdout.read().decode("utf-8").rstrip()