【发布时间】:2016-03-09 16:38:18
【问题描述】:
我最近安装了 Waterfox 浏览器,它本质上是一个速度更快的 64 位 Firefox,它共享 Firefox 的用户数据文件夹。此后,使用 selenium 调用 Firefox,如下行所示,调用 Waterfox 浏览器:
from selenium import webdriver
browser = webdriver.Firefox()
片刻之后,程序崩溃,产生以下回溯:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python\lib\site-packages\selenium\webdriver\firefox\webdriver.py",
line 77, in __init__
self.binary, timeout),
File "C:\Python\lib\site-packages\selenium\webdriver\firefox\extension_conne
ction.py", line 49, in __init__
self.binary.launch_browser(self.profile)
File "C:\Python\lib\site-packages\selenium\webdriver\firefox\firefox_binary.
py", line 68, in launch_browser
self._wait_until_connectable()
File "C:\Python\lib\site-packages\selenium\webdriver\firefox\firefox_binary.
py", line 103, in _wait_until_connectable
raise WebDriverException("Can't load the profile. Profile "
selenium.common.exceptions.WebDriverException: Message: Can't load the profile.
Profile Dir: %s If you specified a log_file in the FirefoxBinary constructor, ch
eck it for details.
有没有办法明确告诉 selenium 调用实际的 Firefox 浏览器(除非必要,我不倾向于修改系统注册表),而不是打开 Waterfox?
【问题讨论】: