2016-07-01 25 views
1

我希望这是简单的东西,感觉就像它。但目前这超出了我的视野。 我是Selenium的新手,我想自动从网站提取信息,这似乎是一个好方法。 对于一个改变,我已经开始在Windows 10上做这个工作,我想用Python编程,所以我使用了PyCharm。我已经安装使用pip install selenium硒,如果我使用Python命令行shell有以下几点:Selenium webdriver.Firefox()不可调用

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

我没有安装东西吗?

>

+0

您可以尝试将您的Firefox降级到版本45并重新运行脚本?另外,禁用Firefox中的设置以自动更新。 –

+0

我回到了Firefox 45.0,'webdriver.Firefox()'命令现在启动了一个Firefox窗口。这是否意味着Selenium和Firefox 47之间存在问题? – fatherdamo

+0

我觉得有一个答案[这里](http://stackoverflow.com/questions/37761668/cant-open-browser-with-selenium-after-firefox-update)。明天我会有一个适当的看看,今天我有点忙。 – fatherdamo

回答

0

并不意味着作为一个愚蠢的反应,但你有你的机器上安装Firefox的最新版本?

+0

我相信,Firefox 47.0在几个星期前安装/更新。 – fatherdamo

相关问题