Python Selenium连接错误

Python Selenium连接错误,python,firefox,selenium,selenium-webdriver,Python,Firefox,Selenium,Selenium Webdriver,以前有人遇到过这个错误吗?我在周一刚开始犯这个错误。为什么它在连接方面有问题 Selenium将打开浏览器,但不会插入url C:\Python34\python.exe "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.5\helpers\pydev\pydevd.py" --multiproc --client 127.0.0.1 --port 49660 --file //HAL1/FTP-Directori

以前有人遇到过这个错误吗?我在周一刚开始犯这个错误。为什么它在连接方面有问题

Selenium将打开浏览器,但不会插入url

  C:\Python34\python.exe "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.5\helpers\pydev\pydevd.py" --multiproc --client 127.0.0.1 --port 49660 --file //HAL1/FTP-Directories/Comal-County/comal.py
  pydev debugger: process 5564 is connecting

  Connected to pydev debugger (build 139.1547)
  Traceback (most recent call last):
    File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.5\helpers\pydev\pydevd.py", line 2217, in       <module>
      globals = debugger.run(setup['file'], None, None)
    File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.0.5\helpers\pydev\pydevd.py", line 1643, in run
      pydev_imports.execfile(file, globals, locals)  # execute the script
    File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition4.0.5\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
      exec(compile(contents+"\n", file, 'exec'), glob, loc) 
    File "//HAL1/FTP-Directories/Comal-County/comal.py", line 7, in <module>
      driver = webdriver.Firefox();
    File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 59, in __init__
      self.binary, timeout),
    File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 47, in __init__
      self.binary.launch_browser(self.profile)
    File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 66, in launch_browser
      self._wait_until_connectable()
    File "C:\Python34\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 105, 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, check it for details.

这是
selenium
Firefox
之间的兼容性问题

将您的
Firefox
升级至最新版本(目前为36)

并将selenium升级至最新版本(目前为2.45):


当有“主要版本”FF发布时,这是一种常见情况;FF42最近也出现了这种情况

暂时的解决办法是:;您可能需要重复执行此操作


从长远来看,硒的下一个版本应该解决这个问题;新的Selenium版本通常紧跟在新的FF主要版本之后

谢谢,你用什么程序来执行这些代码?我熟悉pip。我只是想把它打开。你使用Python Shell还是Cmd窗口?@djowarth当然,既然你在windows上,就使用
Cmd
。很好。谢谢@AlecXeth,这并没有解决问题。Firefox 37.0.2/selenium 2.45.0
from selenium import webdriver
driver = webdriver.Firefox();
driver.get("http://www.google.com")
pip install --upgrade selenium