Selenium webdriver.Firefox()不可调用

时间:2016-07-01 14:32:53

标签: selenium pycharm

我希望这很简单,就像它一样。但目前它超出了我的范围。 我是Selenium的新手,我想自动从网站中提取信息,这似乎是一个很好的方法。 对于一个更改,我已经开始在Windows 10上执行此操作,我想要使用Python编写程序,因此我使用的是PyCharm。我使用pip install selenium安装了Selenium,如果我使用python命令行shell,则使用以下内容:

from selenium import webdriver
driver = webdriver.Firefox()

我收到以下错误消息:

Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from selenium import webdriver
>>> driver = webdriver.Firefox()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Damo\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 81, in __init__
self.binary, timeout)
  File "C:\Users\Damo\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 51, in __init__
self.binary.launch_browser(self.profile, timeout=timeout)
  File "C:\Users\Damo\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 68, in launch_browser
self._wait_until_connectable(timeout=timeout)
  File "C:\Users\Damo\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 98, in _wait_until_connectable
raise WebDriverException("The browser appears to have exited "
selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.

当我在PyCharm中输入相同内容时,IDE会告诉我这个术语webdriver.Fiefox会导致Firefox is not callable

我没有安装东西吗?

  
    

&GT;

  

1 个答案:

答案 0 :(得分:0)

并不是一种愚蠢的反应,但你的机器上安装了最新版本的Firefox吗?