在Python3.2中不能加载Selenium 2.44和FF32的配置文件

2024-09-28 12:12:50 发布

您现在位置:Python中文网/ 问答频道 /正文

使用python3.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.

我做错什么了吗?我搜索了google,也发现了类似的问题,但所有专家都建议将selenium升级到最新版本,我已经这么做了。我试着用FF 24,28检查,但没能解决。请帮帮我


Tags: the代码inbrowserusrselenium错误firefox
1条回答
网友
1楼 · 发布于 2024-09-28 12:12:50

看起来selenium的配置文件路径处理在Cygwin中有问题

临时黑客攻击

在cygwin_dir\lib\python3.2\site packages\selenium\webdriver\firefox\firefox中_二进制.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() 

相关问题 更多 >

    热门问题