【发布时间】:2016-08-21 02:26:44
【问题描述】:
我已经使用 webdriver.Firefox() 多年了,今天我开始了另一个项目,browser = webdriver.Firefox() 正在返回
WebDriverException: Message: Can't load the profile. Profile Dir: %s If you specified a log_file in the FirefoxBinary constructor, check it for details.
我已尝试将 C:\Program Files (x86)\Mozilla Firefox\firefox.exe 添加到我的 PATH 中。我试过pip install -U selenium。我试过了
binary = FirefoxBinary('C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe')
browser = webdriver.Firefox(firefox_binary=binary)
profile = FirefoxProfile("C:\Users\Me\AppData\Roaming\Mozilla\Firefox\Profiles\8u2w2ge1.Me")
browser = webdriver.Firefox(profile)
我已将插件检查兼容性添加到我的 Firefox 插件中。没有,没有任何工作,同样的错误,Python 2.7.11,Windows 10 x64
这是我得到的一般回溯。
Traceback (most recent call last):
File "<pyshell#14>", line 1, in <module>
browser = webdriver.Firefox(firefox_binary=binary)
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 80, in __init__
self.binary, timeout)
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 52, in __init__
self.binary.launch_browser(self.profile, timeout=timeout)
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 68, in launch_browser
self._wait_until_connectable(timeout=timeout)
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 108, in _wait_until_connectable
% (self.profile.path))
WebDriverException: Message: Can't load the profile. Profile Dir: c:\users\me\appdata\local\temp\tmpwvgny8 If you specified a log_file in the FirefoxBinary constructor, check it for details.
有人知道为什么在临时目录中创建此配置文件时遇到问题吗?一些新的方法来强制它存在于配置文件中,因为我的旧方法不起作用。
【问题讨论】:
-
你需要尝试将
C:\Program Files (x86)\Mozilla Firefox添加到没有exe的路径。 -
>dir c:\users\me\appdata\local\temp\tmpwvgny8的结果是什么? -
是否期待来自此地址的配置文件:消息:无法加载配置文件。配置文件目录:c:\users\me\appdata\local\temp\tmpwvgny8 ?
-
@randominstanceOfLivingThing 我删除了 firefox.exe 我得到了相同的结果。这是一个看起来和我的普通配置文件非常相似的文件夹,保存所有插件的东西。
-
@AbirKhan 我相信是的,当我查看时,配置文件文件夹就在那里。