【发布时间】:2016-08-30 19:37:51
【问题描述】:
我正在尝试了解 Selenium,但我什至无法获得一个简单的程序来测试。 Selenium webdriver 好像没有和火狐合作,我很沮丧,所以我来 Stack Overflow 寻求帮助。
作为背景,我使用 Python,可以使用 pip 安装,并且知道命令行。 我在 windows 10、firefox 48 和 selenium webdriver 3 上使用 python 3.5.2
每当我运行 selenium 测试时,(它会打开一个 Firefox 窗口和 selenium 网站)
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://www.seleniumhq.org')
我总是得到一个错误:
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: C:\ ... \AppData\Local\Temp\tmp68m5rtwt If you specified a log_file in the FirefoxBinary constructor, check it for details
它还会打开一个 firefox 窗口,并有 about:blank&utm_content=firstrun 的链接(不是有效的 url)
我在互联网上查看过类似的情况,但没有真正接近。我还尝试了许多教程,并确保我以正确的方式安装了 selenium。我注意到 Firefox 最近更新了,但我不确定这是否有任何影响。
我将不胜感激任何帮助,以及我应该做什么的说明。
【问题讨论】:
-
由于某种原因,它无法加载/创建配置文件。可能是权限、完整性错误,谁知道呢。在这里尝试解决方案:stackoverflow.com/questions/26126588/…
标签: python python-3.x selenium-webdriver