Firefox上的selenium python问题

Firefox上的selenium python问题,python,firefox,selenium,selenium-webdriver,Python,Firefox,Selenium,Selenium Webdriver,我是硒的新手,正在关注该网站 我尝试了网站上的以下代码 from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Firefox() driver.get("http://www.python.org") assert "Python" in driver.title elem = driver.find_element_by_name("q") elem.

我是硒的新手,正在关注该网站

我尝试了网站上的以下代码

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox()
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()
当我运行这个程序时,会打开一个Firefox实例,但不会加载页面

这是我在输出控制台中收到的内容

C:\Users\Gauss\Desktop>python test.py
Traceback (most recent call last):
  File "test.py", line 4, in <module>
    driver = webdriver.Firefox()
  File "D:\Python\Python35\lib\site-packages\selenium-2.50.0-py3.5.egg\selenium\webdriver\firefox\webdriver.py", line 78, in __init__
    self.binary, timeout)
  File "D:\Python\Python35\lib\site-packages\selenium-2.50.0-py3.5.egg\selenium\webdriver\firefox\extension_connection.py", line 49, in __init__
    self.binary.launch_browser(self.profile)
  File "D:\Python\Python35\lib\site-packages\selenium-2.50.0-py3.5.egg\selenium\webdriver\firefox\firefox_binary.py", line 68, in launch_browser
    self._wait_until_connectable()
  File "D:\Python\Python35\lib\site-packages\selenium-2.50.0-py3.5.egg\selenium\webdriver\firefox\firefox_binary.py", line 106, in _wait_until_connectable
% (self.profile.path))
selenium.common.exceptions.WebDriverException: Message: Can't load the profile. Profile Dir: C:\Users\Gauss\AppData\Local\Temp\tmpkpjhnhpb If you specified a log_file in the FirefoxBinary constructor, check it for details.
C:\Users\Gauss\Desktop>python test.py
回溯(最近一次呼叫最后一次):
文件“test.py”,第4行,在
driver=webdriver.Firefox()
文件“D:\Python\Python35\lib\site packages\selenium-2.50.0-py3.5.egg\selenium\webdriver\firefox\webdriver.py”,第78行,在\uu init中__
self.binary,超时)
文件“D:\Python\Python35\lib\site packages\selenium-2.50.0-py3.5.egg\selenium\webdriver\firefox\extension\u connection.py”,第49行,在\uu init中__
self.binary.launch_浏览器(self.profile)
文件“D:\Python\Python35\lib\site packages\selenium-2.50.0-py3.5.egg\selenium\webdriver\firefox\firefox\u binary.py”,第68行,在启动浏览器中
self.\u等待\u直到\u可连接()
文件“D:\Python\Python35\lib\site packages\selenium-2.50.0-py3.5.egg\selenium\webdriver\firefox\firefox\u binary.py”,第106行,在“等待”直到“可连接”
%(self.profile.path)
selenium.common.exceptions.WebDriverException:消息:无法加载配置文件。Profile Dir:C:\Users\Gauss\AppData\Local\Temp\tmpkpjhnhpb如果您在FirefoxBinary构造函数中指定了日志文件,请查看该文件以了解详细信息。
有人能为这个问题提出一个解决方案吗


注意:这个问题出现在我的office pc上,同样的代码在我的家用pc上运行良好。因此Firefox可能会出现一些问题。

根据您的评论,它看起来像是python驱动程序提供的Firefox版本。目前,它们最多支持v。38,你有44。

可能重复:这篇文章提到问题是在2.26版后解决的,但我使用的是2.50版,仍然面临这个问题,我在Windows 10上工作,Firefox版本是44.0。我的家用电脑也有Firefox版本44和Selenium 2.50,但在这方面工作正常。问题似乎出现在我的办公室电脑上。