【发布时间】:2016-04-20 02:14:34
【问题描述】:
我正在尝试加载我的 selenium 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.
代码在 15 分钟前运行良好。我不确定发生了什么。
我有 firefox 43.0.4 和 selenium 2.49
这是我抛出错误的代码:
profile = webdriver.FirefoxProfile()
driver = webdriver.Firefox(profile)
我正在使用 Windows 7 Professional,Python 2.7.10 | Anaconda 2.3.0(64 位)
追溯:
Traceback (most recent call last):
File "C:\Users\Moyp\dev\anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 3035, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-15-37f7d14be053>", line 2, in <module>
driver = webdriver.Firefox(profile)
File "C:\Users\Moyp\dev\anaconda\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 77, in __init__
RemoteWebDriver.__init__(self,
File "C:\Users\Moyp\dev\anaconda\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 49, in __init__
self.binary.launch_browser(self.profile)
File "C:\Users\Moyp\dev\anaconda\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 68, in launch_browser
self._wait_until_connectable()
File "C:\Users\Moyp\dev\anaconda\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 103, in _wait_until_connectable
raise WebDriverException("Can't load the profile. Profile "
WebDriverException: Message: Can't load the profile. Profile Dir: %s If you specified a log_file in the FirefoxBinary constructor, check it for details.
【问题讨论】:
-
在 Python 2.7 和 Python 3.5 上使用 MacOS、Selenium 2.49 和 Firefox 43.0.4 进行测试 - 没有错误。您能否分享有关您的设置、您执行的代码和完整回溯的更多详细信息?
-
我只是添加了更多细节,我执行的代码是我发布的 2 行
-
刚刚又更新了traceback,之前记错了
-
快速检查一下:您能
import selenium并在您的IPython 终端中打印出selenium.__version__吗?谢谢。 -
说它的'2.46.1',我刚刚重新启动了pycharm,它说'2.49',代码现在可以工作了。谢谢!